Bash - Pipeline


This article talks about the syntax of a Shell Pipeline in Bash

All command(s) in a pipeline are executed in parallel.

This page talks about pipeline (e ia command that takes the output of a command as input), a succession of a command in bash is called a list


This is the same syntax than a shell pipeline where you can add the time command

[time [-p]] pipeline]


  • time print the time statistics.
  • The -p option changes the output format to that specified by posix. The TIMEFORMAT variable may be set to a format string that specifies how the timing information should be displayed.



If the pipeline is not executed asynchronously (see Lists), the shell waits for all commands in the pipeline to complete.


Each command in a pipeline is executed as a separate process (i.e., in its own subshell). The shell waits for all commands in the pipeline to terminate before returning a value.

Exit Status

The exit status of a pipeline is the exit status of the last command in the pipeline, unless the pipefail option is enabled (see The Set Builtin).

If pipefail is enabled, the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully.

If the reserved word ‘!’ precedes the pipeline, the exit status is the logical negation of the exit status.

Documentation / Reference

Powered by ComboStrap