CSC 271
Homework 5
Assigned 25 Nov
Due 9 Dec
Write a C or C++ program which acts as a simple shell: it repeatedly
prints a prompt, reads a command line from stdin, and executes it.
The basic version of the program has only one built-in command, "exit",
which gets you out of the program; in addition to "exit", it should be
capable of running any program in the standard system paths
(e.g. /bin,/usr/local/bin,etc.).
You may use the "system" function to send the command to the Bourne
shell for execution.
More advanced features, each of which is worth additional credit:
- A built-in "cd" command.
- A built-in "printenv" command.
- A built-in "setenv" command.
- Parsing the command line yourself and running commands with
"fork()" and "exec" rather than "system".
- Handling pipes and/or I/O redirection yourself.
Last modified:
Tue Dec 2 16:00:26 EST 1997
Stephen Bloch / sbloch@boethius.adelphi.edu