Question
#include #include #include #include #include /* Simple example of using gnu readline to get lines of input from a user. Needs to be linked with
#include
Task 5: Pipelined Instructions Your shell must support pipelined instructions - this means that each command line could include a number of external commands. Note that you do not need to support pipes with internal commands. For each pipe in the command line you need to take care of connecting stdout of the left command to stdin of the command following the "|". For example, if the user types "ls -al | sort", you need to arrange things so that the ls command is run with stdout directed to a Unix pipe, and that the sort command is run with stdin coming from that same pipe. A pipe is basically a buffer held by the kernel, having two file descriptors, one for reading and one for writing. The pipe maintains the order of the bytes, so that the first byte written to the pipe is the first byte read from the pipe. The pipe system call creates a pipe and generates two file descriptors. In order to create a pipe between two commands, your shell will need to create a pipe and then fork a child process for each command. In one process, you will redirect from stdout into the writing end of the pipe and in the other you will redirect from stdin to the reading end of the pipe. For this assignment, you will be required to pipeline two commands together. Pipelining and redirection should work together. For example, you should support ls -al| sort > output.txt.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started