Project 2: File Redirection in the Shell

Due Monday, December 1

In a recent video series, we created a simple shell. However, it lacks redirection operators! Improve the shell, so that it supports 5 redirection operators:
>  >>  2>  2>>  <
This should support commands such as:
grep tiger * 2>/dev/null
Or this:
date >>     date_log
Or this:
bc < math_problem
It may be most efficient to open the files only in the child process, so that you don't have to remember to close them in the parent process. Generally shell behavior is to supersede pipes with file redirection, so don't be concerned about using dup even if a pipe was already created.

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).