set -o pipefail

Category: Shell & Bash

set -o pipefail

Return non-zero if any command in a pipeline fails

Changes the behavior of pipelines (commands joined with |): the pipeline fails if ANY command in it fails, not just the last one.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.