That's not specifically bash though, that's process exit codes
Re:Sshole
by raverbashing on Thursday November 05, 2026 @12:55PM
(#50382118)
Yes. But it's still contradictory
The question you are asking when querying a process exit code is "did this program exit with an error?". The default assumption is "no, it completed successfully", so 0 (false) is the logical expected default return.
A function is expected to produce a result - so the question is "what was the result?". !0 (something) is the logical expected default return.
I've never found it to be contradictory.
But in shell, 0 is true, not false. The program called true returns 0.
Re:Sshole
by Dylan16807 on Friday November 06, 2026 @06:16AM
(#50390952)
"True has 0 errors" is the straightforward part.
"False pretends to have an error" is where it gets weird. It's not that they got booleans backwards, it's that they're stretching a tenuous analogy a bit too far.
Re:Sshole
by raverbashing on Sunday November 08, 2026 @12:20PM
(#50415175)
> The default assumption is "no, it completed successfully"
Correct
> so 0 (false) is the logical expected default return.
Nope
We came to expect zero because we got accustomed to it. And it is a "good enough solution" in memory constrained systems.
And note some programs attribute >0 and <0 to different types of errors
Honestly I've been shaking my fist at these since the XOn/XOff days