Bash - Pipeline

1 - Pipeline

Shell Data Processing - 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

3 - Syntax

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


[time [-p]] pipeline]

where:

  • 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.

4 - Execution

4.1 - (A)synchronous

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

4.2 - Parallel

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.

4.3 - 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.

5 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap