Question: This problem builds significantly on the previous problem. Specifically, it asks you to again use fork() to create processes and exec() (or one of the
This problem builds significantly on the previous problem. Specifically, it asks you to again use
fork() to create processes and exec() (or one of the many variants) to assign the newly created
processes what to do. In addition, however, it asks you to mimic the behavior of a shell command
such as:
ls | wc
What happens in the case above is the output of the first command (ls) becomes the input
to the second command (wc). (Try it in a terminal on a Unix machine).
Thus, you are required to write another program that:
Expects an input of the form: cmd1 | cmd2
Creates two processes
Makes the first process run cmd1
Makes the second process run cmd2
Makes sure that the output of the first process becomes the input of the second process (using
the function pipe()).
Waits for the two processes to finish before it ends by printing ++++ on a new line.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
