Due Tuesday, October 4th at 11:59pm. Turn into your Project02 git repo.
For this project you are going to develop a mini UNIX shell called usfsh and a mini version of ls called usfls. In order to implement these applications you will need to understand how to use several UNIX systems calls and how to manipulate kernel provided abstractions such as the file descriptor table.
Note your implementation of usfsh and usfls must both run on your RPi in Raspbian. For interactive grading you must demo on your RPi. You should develop entirely on your RPi. Some of the system calls are not identical on Mac OS X and Linux, so if you develop on your Mac, you solution may not compile and run on your RPi. The moral here is to figure out a way to edit and compile directly on your RPi.
Your shell should print the “$” prompt and wait for user input. For example:
You should be able to execute commands that are in the current directory using the “./” notation:
You should also be able to execute an command available in the PATH environment variable. For example:
If the user types in a command that is not on the PATH, then you should print an error message:
foobar: command not found
You should be able to pass arguments to commands:
$ echo hi there
You need to support file output redirection:
$ echo hi there > hi.txt
This will create or overwrite a file called hi.txt and put the output of the first command into the file.
You need to support pipe redirection:
$ echo world hello | wc
1 2 12
In both file redirection and pipe redirection you need to support multiple arguments.
You need to support a built-in “cd” command to change directories:
$ cd foo
$ cd ..
(Hint: use the chdir system call)
You also need to support a built-in "exit" command that will exit usfsh.
You need to implement your own version of ls called usfls. Your implementation needs to use the readdir system calls to list the contents of the current directory. You can list the files and directories on separate lines:
Your usfls should not list files that start with a dot “.”.
Each worth one point.