Windows Standard Codes
Windows Standard Codes
Code
Number
1 Catchall for general let "var1 = Miscellaneous errors, such
errors 1/0" as "divide by zero" and other
impermissible operations
2 Misuse of shell empty_functio Missing keyword or command,
builtins (according n() {} or permission problem
to Bash (and dif return code on a failed
documentation) binary file comparison).
126 Command invoked /dev/null Permission problem or
cannot execute command is not an executable
127 "command not illegal_comma Possible problem with $PATH or a
found" nd typo
128 Invalid argument exit 3.14159 exit takes only integer args in
to exit the range 0 - 255 (see first
footnote)
128+n Fatal error signal "n" kill -9 $PPID of $? returns 137 (128 + 9)
script
130 Script terminated by Ctl-C Control-C is fatal error signal 2,
Control-C (130 = 128 + 2, see above)
255* Exit status out of exit -1 exit takes only integer args in
range the range 0 - 255
According to the above table, exit codes 1 - 2, 126 - 165, and 255 have
special meanings, and should therefore be avoided for user-specified exit
parameters. Ending a script with exit 127 would certainly cause confusion
when troubleshooting (is the error code a "command not found" or a user-
defined one?). However, many scripts use an exit 1 as a general bailout-
upon-error. Since exit code 1 signifies so many possible errors, it is not
particularly useful in debugging.