$RodHat_/search
exit code reference

Exit 0

Success.

Value
0
Convention
Shell and tool convention

The only value every tool agrees on. It means the process reported success, not that the work is correct: a pipeline reports the status of its last command, so a failed producer can sit behind a consumer that exits 0. If the thing matters, check the whole pipeline with pipefail or PIPESTATUS instead of trusting one zero.

What to check

set -o pipefail; producer | consumer; echo "${PIPESTATUS[@]}"

Rod on this

Sources

  1. Exit Status, GNU Bash manual

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