Exit Codes: Difference between revisions
From Leo's Notes
This page was last edited on 27 April 2021, at 18:11.
Created page with "Here are some common exit codes that may be returned by a program or script. {| class="wikitable" !Status !Description |- |0 |Successful Termination |- |1 |General Error |- |1..." |
No edit summary |
||
| Line 9: | Line 9: | ||
|1 | |1 | ||
|General Error | |General Error | ||
|- | |||
|2 | |||
|Misuse of shell builtins, keywords, or functions | |||
|- | |- | ||
|126 | |126 | ||
| Line 14: | Line 17: | ||
|- | |- | ||
|127 | |127 | ||
|Command Not Found | |Command Not Found. Path or typo issue. | ||
|- | |- | ||
|128+n | |128+n | ||
| Line 33: | Line 36: | ||
|- | |- | ||
|255 | |255 | ||
| | |Maximum exit code value. Obtained when the program calls <code>exit -1</code>. | ||
|- | |||
|256+ | |||
|All higher exit codes should be reduced down to the 0-255 range via the modulo operator. | |||
Eg. Code 3809 % 256 results in 225 | |||
|} | |} | ||
== See Also == | ==See Also== | ||
* https://tldp.org/LDP/abs/html/exitcodes.html | *https://tldp.org/LDP/abs/html/exitcodes.html | ||
Revision as of 18:11, 27 April 2021
Here are some common exit codes that may be returned by a program or script.
| Status | Description |
|---|---|
| 0 | Successful Termination |
| 1 | General Error |
| 2 | Misuse of shell builtins, keywords, or functions |
| 126 | Cannot Execute |
| 127 | Command Not Found. Path or typo issue. |
| 128+n | Fatal error signal n, where n is the signal number as defined in: |
| 130 | Program Interrupted (SIGINT, 2), such as termination from Ctrl-C |
| 134 | Program Abort (SIGABRT, 6) |
| 136 | Erroneous Arithmetic Operation (SIGFPE, 8), such as division by zero |
| 139 | Segmentation Fault (SIGSEGV, 11) |
| 255 | Maximum exit code value. Obtained when the program calls exit -1.
|
| 256+ | All higher exit codes should be reduced down to the 0-255 range via the modulo operator.
Eg. Code 3809 % 256 results in 225 |