This program replicates the functionality of the pipe operator (|). It pipes the output of the first program into the second, the output of the second into the third, and so on until the last one.
To build the executable, simply run make
in the folder where the Makefile and all other files are present.
This program produces output identical to that of the the pipe operator. To run this program, run ./pipe
followed by all the arguments (Linux commands you want to pipe).
Example 1: ./pipe ls cat wc
This checks out, because there are 8 lines printed, each with one filename, totaling 75 characters. The cat
simply propagates the output forward in this case.
Example 2: ./pipe cal echo pwd
The cal
output, which is echo
'd is ignored by pwd
since its job is to print the current working directory.
Similarly, you can pipe any (reasonable) number of arguments together.
To clean up all binary files, run make clean
.