Computer Science 330
Operating Systems
Fall 2022, Siena College
In this programming project, you will write the first version of a C program called the Roger Bacon Shell (rbsh), a mini command shell interpreter. rbsh is similar to familiar Unix shells such as the Bourne shell (sh) the Bourne-Again shell (bash), and C shell (csh, tcsh). By the time you get through the final version, you will learn about process creation, pipes, input/output redirection, background process management, signals, and interrupt handling, and gain extensive experience with C.
You may work alone or in groups of size 2 or 3 on this programming project. However, in order to make sure you learn the material and are well-prepared for the exams, those who work in a group should either collaborate closely while completing the project.
There is a significant amount of work to be done here. It will be difficult if not impossible to complete the assignment if you wait until the last minute. You will need to ask questions. A slow and steady approach will be much more effective.
Getting Set Up
In Canvas, you will find a link to follow to set up your GitHub repository, which will be named basicshell-proj-yourgitname, for this programming project. Only one member of the group should follow the link to set up the repository on GitHub, then others should request a link to be granted write access.
All GitHub repositories must be created with all group members having write access and all group member names specified in the README.md file by 9:20 AM, Monday, November 7, 2022. This applies to those who choose to work alone as well!
Requirements
Like the Unix shells you use every day, rbsh should issue a prompt (below, it is "shell#"), at which it reads commands from the user and executes them.
Your shell should interpret the following commands and provide the following functionality:
For example,
shell# cat cat.c
should execute cat with one argument, cat.c.
getenv("HOME")
).
Otherwise, it changes to the directory given as the command-line
parameter. It is an error to have more than one command-line
parameter, and it should be reported as such.
Notes
#ifdef
and #endif
directives. You can see an example
of this in the starter code. Note that there are two preprocessor
symbols defined: PARSE_DEBUG
and PROC_CONTROL_DEBUG
.
You should protect your debugging that has to do with parsing the
text read into the cmd_line
variable into its parts (a task
that is already non-trivial in this version and will become a
significant challenge later when you add pipes and I/O redirection)
with PARSE_DEBUG
. Use printouts protected by
PROC_CONTROL_DEBUG
to report when processes are created and
complete. Again, this will become much more complicated once you
have pipes and background execution later. Good use of this
verbose/debugging mode is essential for, well, debugging. And it's
part of the grading, so do it.
Submission
Commit and push!
For this project, an in-person demonstration and code review is required for each group following submission. This can occur during office hours or by appointment.
Grading
This assignment will be graded out of 60 points.
Feature | Value | Score |
Documentation | 10 | |
Verbose mode output | 5 | |
exit and help commands | 2 | |
Running a command with no arguments | 15 | |
Running a command with arguments | 20 | |
Builtin cd command | 3 | |
In-person demo and code review | 5 | |
Total | 60 | |