Each command in a pipeline is executed in its own subshell . The exit status of a pipeline is the exit status of the last command in the pipeline, unless the pipefail option is enabled .
If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.
An array variable (see Arrays) containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command).