 | | The eqn program reads its input from the file report, just as in the previous example. But, instead of storing its output in the file out1, we have told the shell to connect the standard output from eqn to the standard input of the tbl command. The tbl command, instead of reading its input from the file out1, reads it from standard input. The standard output from tbl has been connected to the standard input of troff. The standard output from troff has been connected to the standard input of psdit. And finally, the standard output from psdit has been connected to the standard input of lp. Thus, data flows from one program to the next, with no need for temporary files in between. The tool used to connect these programs together is a pipe. The programs themselves, however, have no knowledge of being used in this manner—they just know that if there are no filename arguments given to them on the command line, they should read from their standard input and write to their standard output. For all they know, the standard input could be a file and the standard output could be the terminal screen. Because pipes work just like file descriptors, there is no need for special code in each of these programs to handle them. | |
|