Question: Write a program called minishell that creates two child processes: one to execute 'ls -al' and the other to execute grep main minishell.c. After the

Write a program called minishell that creates two child processes: one to execute 'ls -al' and the other to execute grep main minishell.c. After the forks, the original parent process waits for both child processes to finish before it terminates. The parent should print out the pid of each child after it finishes. The standard output of 'ls -al' process should be piped to the input to the 'grep minishell minishell.c' process. Make sure you close the unnecessary open files for the three processes. The output should be the one line that includes the directory entry for minishell.c. You will need to call the source file minishell.c for this to work properly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!