| 1 | #!/bin/bash |
| 2 | |
| 3 | echo hello |
| 4 | echo $? # Exit status 0 returned because command executed successfully. |
| 5 | |
| 6 | lskdf # Unrecognized command. |
| 7 | echo $? # Non-zero exit status returned -- command failed to execute. |
| 8 | |
| 9 | echo |
| 10 | |
| 11 | exit 113 # Will return 113 to shell. |
| 12 | # To verify this, type "echo $?" after script terminates. |
| 13 | |
| 14 | # By convention, an 'exit 0' indicates success, |
| 15 | #+ while a non-zero exit value means an error or anomalous condition. |
| 16 | # See the "Exit Codes With Special Meanings" appendix. |