This project consists of several small parts, to help you understand the concepts better.
Do this as a normal, regular, single-process, single-threaded program.
Use fork to spawn the child processes. Use a pipe as the means of communication to pass that value from the first child to the second child.
Hint: This requires two calls to fork, and one call to pipe.
Write and submit two versions of your program:
Hint: The difference between the programs for two versions should be very small.
Note: You may not use the system or popen library calls. Rather, you must use system calls such as fork, dup2 and the exec-family.
(Note: a string after the filename is illegal, and the shell should detect that, and print an error message instead of executing anything. For example: ``ls < datafile foo'')
(Note: any string after the filename is illegal, and the shell should detect that, and print an error message instead of executing anything. For example: ``ls > outputfile foo'')
So, this version needs to accept the examples given in all the above parts, as well as things such as: ``ls -l /tmp > filefile'', ``grep Hello < infile > outfile'', ``grep Hello > outfile < infile''.
Note, however, that you do not have to be able to mix file redirection with the environment or builtin commands. So being able to do the following is not required: ``printenv PATH > filename'', ``pwd > file''