I am writing a program in C for x86 Linux. I am wanting to use my own customer exit codes to help the user with debugging problems when the program doesn't execute as expected.
As an example, suppose the program was a command line calculator and I would like to return the following exit codes and document them in the man pages;
- Calculation completes and prints results to screen (normal operation) - return 0
- Invalid number of operands supplied (syntax error basically!) - return 1
- Some other error - return 2
- Another error - return 3
I have seen a few pages like this one which make me think I can't return any exit code I like. Is there any official rules (BASH or Linux standard/guideline) I should be following here, apart from 0 == normal exit?