Bourne
| Ash
| #!
| find
| ARG_MAX
| Shells
| portability
| permissions
| UUOC
| ancient
| -
| ../Various
| HOME
"$@"
| echo/printf
| set -e
| test
| tty defs
| tty chars
| $() vs )
| IFS
| using siginfo
| nanosleep
| line charset
| locale
Exit status of a pipeline
The behaviour about the exit status of a pipeline in the Bourne shell
changed with System III and with SVR2:
- On Version 7, the status was determined by the first and
the last command in the pipeline.
The last command had precedence, that is, the first command was only
relevant, if the last exited with zero.
Examples:
| Pipeline
| Exit Status
|
(exit 0) | (exit 1)
| 1
|
(exit 2) | (exit 1)
| 1
|
(exit 2) | (exit 0)
| 2
|
(exit 3) | (exit 2) | (exit 0)
| 3
|
(exit 3) | (exit 2) | (exit 1)
| 1
|
- With System III, both first and last command were still relevant, but now the first command had precedence.
- On SVR2 and later, the exit status was determined by the last command.
This is the bahaviour one is used to nowadays.
2005-11-06, 2008-09-23