$RodHat_/search
exit code reference

Exit 141 SIGPIPE (128 + 13)

Wrote to a pipe nobody is reading.

Value
141
Convention
Killed by a signal (128 + N)
Signal
SIGPIPE (Linux 13, FreeBSD 13)

The everyday case is head closing its input early: yes | head -1 makes the producer die of SIGPIPE. Under set -o pipefail that status becomes the whole pipeline's status, so a pipeline that is working as designed reports failure. Treat 141 from the left side of a pipe feeding head or grep -q as normal.

What to check

set -o pipefail; yes | head -1; echo $?

Rod on this

Sources

  1. Exit Status, GNU Bash manual
  2. signal(7), Linux man-pages

Exit codes are conventions, not guarantees: a program can return any value from 0 to 255. Spot one that's wrong? Tell Rod.