For example, it is common programming practice for a child process to return (exit with) zero to the parent signifying success.
[1] Alternatively, each bit may indicate a different condition, with these being evaluated by the or operator together to give the final value; for example, fsck does this.
Sometimes, if the codes are designed with this purpose in mind, they can be used directly as a branch index upon return to the initiating program to avoid additional tests.
In AmigaOS, MorphOS and AROS, four levels are defined: Shell scripts typically execute commands and capture their exit statuses.
If a command fails because of an error during expansion or redirection, the exit status is greater than zero.
In DOS terminology, an errorlevel is an integer exit code returned by an executable program or subroutine.
[4][6] Multiuser DOS supports a reserved environment variable %ERRORLVL% which gets automatically updated on return from applications.
If the child terminated by exiting (as determined by the WIFEXITED() macro; the usual alternative being that it died from an uncaught signal), SUS specifies that the low-order 8 bits of the exit status can be retrieved from the status value using the WEXITSTATUS() macro.
In the waitid() system call (added with SUSv1), the child exit status and other information are no longer in a bitfield but in the structure of type siginfo_t.
[15] The Advanced Bash-Scripting Guide has some information on the meaning of non-0 exit status codes.
[17] Microsoft Windows uses 32-bit unsigned integers as exit codes,[18][19] although the command interpreter treats them as signed.
[20] Exit codes are directly referenced, for example, by the command line interpreter CMD.exe in the errorlevel terminology inherited from DOS.