Is 128 fully portable? For the longest time, I thought the safe portable
maximum was 126 (with 127 reserved for some kind of abnormal
termination) but that information may be more than a decade old. Current
safe range would seem to be 0..255, I can't find any concrete exceptions
to that rule.
The exit and wait procedures support 0-255, no problem. However, when a process running in the shell dies on a signal, the variable $? is set to 128 plus the signal number. Consequently, these two exit situations are indistinguishable to the shell:
$ (exit 129); echo $?
129
$ sh -c '/bin/kill 1 $$'; echo $?
Hangup
129
This only affects shell scripts that actually examine $?. In 30+ years of shell programming I have never done so that I can remember.
I think exit code 1 ("catchall for general errors") is the right mapping for #f. It is also what Chibi uses on both *ix and Windows. (On Plan 9 Chibi translates #f to "chibi error" and #t to "".)
John Cowan
http://vrici.lojban.org/~cowan xxxxxx@ccil.orgYou annoy me, Rattray! You disgust me! You irritate me unspeakably!
Thank Heaven, I am a man of equable temper, or I should scarcely be able
to contain myself before your mocking visage. --Stalky imitating Macrea