CS631 -- Advanced Programming in the UNIX Environment - Final Assignment
Write a simple shell
In this assignment you will write a simple shell. In doing so, you will apply most of the lessons we learned in this class and gain a better understanding of how complex something as simple as a command-line interpreter can become as you compare the features available in a POSIX compliant shell with your own simple shell.
Write a simple command-line interpreter as described in this manual page. As usual, your homework submission / program will:
Given the number of aspects covered in this assignment, I would suggest that you try to implement features incrementally in the following order:
Shell startup, options parsing, command parsing / tokenization
Begin by implementing the standard getopt(3) flow, initialize your world, print a command-line prompt and read input from the controlling terminal.
Split the given string into tokens.
Make sure your shell can't be terminated by Ctrl+C, Ctrl+\, be suspended via Ctrl+z and can be exited successfully.
Implement all listed builtins with all supported arguments / exit status. Resist the temptation to implement additional features not requested in the assignment.
Create a new process and execute commands. Wait for them to complete. Reap your children. Make their exit status available.
Implement I/O Redirection
Inspect the list of tokens for supported I/O redirection operators. Ensure no illegal combination is given. Implement the correct redirection. Make sure to handle error cases correctly and report meaningful errors to the user.
Split the input by the pipe operator before tokenization. Fork new processes for each command in the pipe, connect stdout/stdin as needed. Execute the commands.
Implement backgrounding of processes
Only implement placing commands into the background after all other functionality is present.
The manual page includes a list of examples. You should consider those basic minimum functionality that your shell should provide as shown there.
In your README, please elaborate on what other tests you considered.
Deliverables and Due Date
You will submit a single tar archive named username-sish.tar that will extract into a directory named after your username. Make sure to include all the files as required by the general homework submission guidelines.
The due date for this assignment is 2020-12-21 18:00. Please attach the file to an email sent from your @stevens.edu email address to firstname.lastname@example.org with a subject of "[CS631] sish".