Tiny Shell
-
Demo
- Source
-
Details
This was a project for an operating systems course I took during my third year at McGill. It is a mock shell implemented in C. You can input commands directly into this program and the shell will execute them. You can pass a file into the program and the shell will run all the commands in the file and then terminate. You can also add a FIFO as an input and the shell will run FIFO mode. This will use the named pipe to execute commands.
For internal commands, the shell can accept four.
history: shows up to the last 100 commands executedchdir: changes the working directory. Works with absolute and relative paths.limit int: sets the soft limit ofRLIM_DATA.checklim: displays the current hard and soft limits ofRLIM_DATA.
For signal handling, the shell can handle two cases.
CTRL^C: the shell will display a message asking the user if they would like to terminate the program. If yes, the shell will terminate. If no, the shell will continue.CTRL^Z: the shell will ignore this command and keep running.
This project was a great experience for me to explore concepts of low-level programming such as memory allocation, processes and inter-process communication, threads, and signal handling. It was one of my more difficult assignments but insightful with a cool end product.