Fork a Command

Fork A Command

Project Information

Created a system with one parent process and two child processes where the children communicate using a pipe.

Fork A Command works by piping the output from the ls -F command to the input of the nl command. We used fork(), and one form of the exec() functions, so that the first child will perform ls -F and pass the output to the second child using a one direction pipe. The second child will perform nl on the list of current directory contents. Later the second child process will print to the screen the result. The parent process will also wait for both its children.