|
Pipes are similar to output redirection, however instead of
the output of a program going to a file, it is fed as
standard input to a second program. You can chain several
pipes together.
To make use of a pipe you use the pipe symbol '|':
commandA | commandB
which will take the standard output of commandA and feed that
as standard input to commandB. When commandA finishes, an end
of file is written to commandB. If commandB still wants
input, it will be taken from the keyboard. If commandB
finishes while commandA is still running, commandA is sent a
signal to quit and any unprocessed output of commandA is
discarded.
If you also want to make standard error output available to a
command, you can use |& which traps both stdout and
stderr, and sends it to commandB.
|