Your shell should repeatedly display a prompt and allow the user to enter a command to run. Your shell should terminate at the end of user input (Control-D sends EOF to an interactive Unix process). The commands may consist of a single program name with arguments, or any number of program names and arguments chained together with the pipe symbol ('|'), which indicates that the standard output of the previous program in the chain should be fed in as standard input to the next program. In addition, user should be able to specify an existing file to use in place of the first program's standard input and/or a file to use in place of the last program's standard output. In each case the name of the file will follow a redirection symbol ('<' for input, '>' for output) after the list of arguments. You should assume that each part of a command is separated by at least one space character.
For example, your shell should be able to process the following commands.
date cal -3 12 2003 grep throw < shell.cpp grep throw > matches grep throw < shell.cpp > matches cat shell.cpp | grep throw | wc cat < shell.cpp | grep -v throw | wc > out
You need not do anything special with quoted arguments, escape characters, or any special symbols that "real" shells allow (for example, >> or >&).