Project 2: File Redirection in the Shell

Due Tuesday, November 28

In class, we've been writing a shell, but so far have avoided adding file redirection! This prevents use of commands like this:
grep tiger * 2> /dev/null
Or this:
date >> date_log
Or this:
bc < math_problem
For the class shell, add support for 5 redirection operators:
>  >>  2>  2>>  <
Our function run_with_redirects should be an excellent spot to handle redirects. Note that whatever use of dup2 you make in run_with_redirects will override what has already been done in handle_pipes, so it should automatically override use of pipes, the same way bash does. In general, if you're wondering if the behaviour is correct, check to see what bash does and do the same thing.
For the append vs. replace, you will have to specify different file opening flags (read about O_APPEND in the manual page for open(2) ). The behaviour should be the same as it is in bash (the default shell on isoptera).

Upload your completed project like project 1.