Question: pipe argument must be between quotes format Realising that passing the argument in the aforesaid format would require you to do further parsing of the
pipe argument must be between quotes format
Realising that passing the argument in the aforesaid format would require you to do further parsing of the input, I'm issuing a correction: please allow your program to accept in the following format: ls "|" wc. That is,
./a.out ls "|" wc
./a.out pwd "|" cat
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 ('1s) 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 cmd 1 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
Get step-by-step solutions from verified subject matter experts
