msh which is short of Minix's Shell is initialized for the project assigned from the course CS551 at IIT.
In this project, you will write your own shell with some minimum requirements from us:
- Your shell shall be invoked from the Ash shell provided with Minix.
- Your shell shall first execute a PROFILE file which defines the “prompt sign” and allows you to access programs provided in /bin and /usr/bin. Once the PROFILE file is executed, you will be in a HOME directory specified by you in the PROFILE file.
- In a command line of your shell you will be able to exercise utilities provided in /bin and /usr/bin. You will need to show that you can do the following:
- a) A command with or without argument such as: cat, ls
- b) A command with or without argument whose output is redirected to a file such as:
ls –l > filename
- c) A command with or without argument whose output is piped to the input of another command such as:
cat filename | wc
- In a command line, your shell can execute a simple application program that will spawn a new process. The application will echo the process id of the new process then exits.
- In a command line, you can define integer variables (such as i with its value indicated by $i) and evaluate integer expressions. Cannot use environmental variables.
- Your shell shall provide a facility that allows a first command to be run and its output to be pasted back as input to another command. The first command is enclosed within $(…).
E.g.
$ wc $(fgrep –l malloc *.c)
will count the number of statements containing the string “malloc” in all the .c files under the current directory This problem must be implemented by using system call. - (Bonus): Can you nest the $(…) facility? Or other interesting feature.
- Your shell shall be terminated by exit or ctl-c. If it is terminated by ctl-c, it first asks the question “Are you sure?”, and wait for confirmation before terminating.
- Submit the following in a VMplayer readable package:
- An executable of your shell
- Source code of your shell programs
- Any other executable and shell scripts to test your programs
- A readme on how to use and test your program
- You will be graded on the robustness of your program.
- Submit a design document of no more than 3 pages (minimum 10 points font) including figures, which must discuss exception handling. The project is due February 2, 2012; February 3 for remote and India students. Self evaluations are due 24 hours afterwards and are private.
- git
- make
- gcc
####1. fork this project
git clone git://github.com/bfeng/msh
####2. write you code
####3. commit
git commit -a "Your comments"
####4. push commits
git push origin master
####5. pull requests