Gnoseed
DevOps · Flashcard

With set -o pipefail, what exit status does a pipeline return?

Why this is the answer

pipefail makes the pipeline's status that of the LAST (rightmost) command to exit non-zero, so an early failure isn't masked. Option two (leftmost) is wrong — it's the rightmost failing one. Option three (final command's status) is the DEFAULT that pipefail changes. Option four inverts the logic — pipefail reports failure if ANY stage fails.

Read more in the docs
Study in Gnoseed →