MiniShell

Deadline: October 31st, 2014. For this assignment you may work in pairs.

1   Instructions

You must implement a program minish which can be used as a Unix shell.

minish must support at least simple commands with zero or more arguments, and commands separated by semicolons. Extra whitespace must be condensed. For example echo hello ; echo world must behave the same as echo hello;echo world. The shell must also support the built-in commands exit and cd; both with either zero or one argument.

You must then choose a selection of features in the following set to achieve a passing grade and beyond, see Grading below:

Constraints:

2   Example commands

$ echo hello; touch /tmp/hello.txt
hello
$ ls /tmp | grep .txt
hello.txt
$ ls /dev >/tmp/hello.txt
$ tr d @ </tmp/hello.txt | grep st@
st@err
st@in
st@out

# Example globbing:
$ ls /dev/std* /tmp/*.c

# Example quoting:
$ echo "hello;\n world"
hello;n world

# Example environment variables:
$ setenv MY hello
$ bash -c "echo $MY"
hello

# Example command groups:
$ ( echo hello; echo world ) >hello.txt
$ tr \n . <hello.txt
hello.world

$ setenv I hello; { setenv I world }; bash -c "echo $I"
world
$ setenv I hello; ( setenv I world ); bash -c "echo $I"
hello

3   Grading

Tips: the maximum grade is 10; there are multiple ways to get there. As usual, go for correctness before completeness. Test a lot. Use version control. Consider pair programming.