mini-shell program on ubuntu using lex, yacc and c code. mini-shell is designed to operate just like the normal linux shell and run all the commands entered.
This application was desgined to run on Linux based systems. You can either use ubuntu linux OS or you could install wsl on a windows OS machine.
to run the makefile, please install make on your system using sudo apt install make. make sure to also install any g++ compiler of your liking for the makefile
Right-click in the project directory and open it in terminal. enter the command make once its done, run the command "./shell"
You have successfully opened the mini-shell!
Please insert any command you'd like just like the original shell terminal. interrupt signals like ctrl+c and exit are also implemented. you could also change directory from inside the mini-shell using the cd command.
our lexical analyzer shell.l contains a dictionary of all the expressions that are tokenizable with their respective mapping to the yacc file
our yacc compiler shell.y contains all the appropriate tokenizations for every expression that can be input to the terminal. This is handled accordingly by setting all the appropriate variables and calling the respective functions developed in the command.cc file.
First, the command.h header file contains all the structures for each command and each simple command when they will be used in the command.cc c file Then, the command.cc handles the processing for each command inserted whether it is 0 commands or more including any piped commands. A for loop is implemented to appropriately set all the input and output redirections accordingly. especially during the execution of the last simple command. calling a background operation using & will result in the parent function not waiting for its previous command to finish executing.
The makefile when run creates all the necessary lex and yacc processing files as well as the shell we run.