points by raverbashing 2 days ago | 0 comments
> "it's all plain text" design that leans extremely heavily upon in-band signalling
Honestly I've been shaking my fist at these since 0 becomes True/Success in Bash and the opposite everywhere else
[–] cwillu 2 days ago
That's not specifically bash though, that's process exit codes
[–] raverbashing 2 days ago
Yes. But it's still contradictory
[–] OnlineTux 2 days ago
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.
[–] xigoi 2 days ago
But in shell, 0 is true, not false. The program called true returns 0.
[–] Dylan16807 1 day ago
"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.
[–] xorcist 2 days ago