A pipeline is a sequence of one or more commands separated by the pipeline control operator (|). The standard output of all but the last command is connected to the standard input of the next command.
The format for a pipeline is:
[ ! ] command1 [ | command2 ... ]
The standard output of command1 is connected to the standard input of command2. The standard input, standard output, or both of a command is considered to be assigned by the pipeline before any redirection specified by redirection operators that are part of the command. The exit status of the pipeline is the exit status of the last command.
If the pipeline is not in the background (described below), qsh waits for all commands to complete.
If the reserved word ! does not precede the pipeline, the exit status is the exit status of the last command specified in the pipeline. Otherwise, the exit status is the logical not of the exit status of the last command. That is, if the last command returns zero, the exit status is 1; if the last command returns greater than zero, the exit status is zero.
Because pipeline assignment of standard input or standard output or both takes place before redirection, it can be modified by redirection. For example:
command1 2>&1 | command2
sends both the standard output and standard error of command1 to the standard input of command2.