Oh, this is interesting! Reading the Crafting Interpreters book, I came across a table of exit codes in FreeBSD.

I didn’t know that a command line usage error is supposed to report exit code 64. In the past I either simply exited with 1 or sometimes each exit statement got its own dedicated number. The latter came in useful for debugging shell scripts. I exactly knew which branch was executed. That was handy when the error messages were similar or even the same.

I was always wondering if there is some kind of a standard, but I never did my reasearch. Looking at other people’s code, it always seemed to me that everybody just did wantever they wanted to in regards to exit codes. I just looked up what else is out there and systemd also defines heaps of errors. It even references the FreeBSD one and links to the Linux Standard Base specification, too. Cool, cool!

Do you guys know of these conventions and make use of them?

⤋ Read More