I was just mucking around with a bash script and I had:
exit 22224;
but the actual exit code was 208
...I assume that's because 208
means "bad exit code" or something? Hard to find info on that
The UNIX exit code is stored in one byte, i.e., between 0 and 255, so anything else is truncated to that single byte. The _exit(2)
manual page even says how:
The value status & 0377 is returned to the parent process as the process's exit status, and can be collected using one of the wait(2) family of calls.
Note that "0377" is just octal for 255. Bitwise-anding with it just means take the last byte. And indeed,
$ python -c 'print(22224 & 255)'
208