Coprocess

Occasionally, a script needs to present input to a program, command, or another script, but not all at once. For instance, you might need to present one item during the beginning of your script, others during the run, and still others at the end. This is generally done by redirecting some input to the appropriate target program. It also can be done through a pipeline. As you saw earlier, a command to the left of the pipe operator presents its output as input to the command to the right of the pipe operator. So, the piping operation is similar to performing redirection, BUT NOT TO A FILE! The redirection is done to the PIPE instead, and the pipe is connected to the next process in the pipeline.

Now consider a situation in which you need ...

Get Korn Shell Programming by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.