set-option

Bash pipefail

Use the rightmost nonzero component status, or zero when all succeed.

Formal Syntax & Structure

bash syntaxbash
set -o pipefail; set +o pipefail

Return Value

exit status

Use the rightmost nonzero component status, or zero when all succeed.

Working Example

Example Snippetbash
set +o pipefailfalse | truesaved=( "$?" "${PIPESTATUS[@]}" )printf 'default: %s\n' "${saved[*]}"set -o pipefailfalse | truesaved=( "$?" "${PIPESTATUS[@]}" )printf 'pipefail: %s\n' "${saved[*]}"
Bash Reference