Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago