C++ application that Emulates Linux shell commands in terminal. It was a college project for an Operating System course that was aimed to apply practical knowlegde on interprocess communication, memeory management and synchronization. The application simply analyzes and parse linux shell commands and execute them. the complexity of the program lies in multiple cases such as handling multiple user commands through pipelining, executing user commands at the background and forwarding execution output to output files and file appending.
The application is broken down into the following steps:
- Take user input from terminal.
- Analyze user command input and breaks it into tokens through lex analyzer.
- Parse user input command according to set of rules or grammer defined by a yacc parser.
- Run C++ handler methods corresponding to different commands and show output on terminal.
Note: Make sure you run the application on a UNIX environment since SystemV Unix library is used in the application.
- Clone the github repo
- run
sudo apt-get install lexto install lex analyzer - run
sudo apt-get install yaccto install yacc parser - run
make cleanto clear any object and extra files used during the compilation process. - run
make allto build the whole project - run
./shellto start using the shell and entering commands
demo preview:
- shell.l: lex file for tokenizing the input syntax and apply lexical analysis
- shell.y: yacc file for grammer rules and parsing token stream
- command.h: C++ header file to define command class and handler objects for command execution
- command.cc: Implementation of the handler objects methods
- Makefile: for building the project
