3 ms·
Pretty sure that we can all agree that bash is a complete unintuitive dumpster fire, so that doesn't count.
by RandomInteger4 9y ago
Pretty sure that we can all agree that bash is a complete unintuitive dumpster fire, so that doesn't count.
- RandomInteger4 9y agoGranted, Lua doesn't consider 0 false either, but at least Lua isn't a dumpster fire. Let's just leave it at C languages + Python, which account for a large percentage of developer mind-share, so to say that it's unintuitive that 0 is falsey is either disingenuous or slightly ignorant.
- boomlinde 9y agoThe point is that the status code is an enumeration of several different values, neither of which are "true" or "false" and that whenever you want to derive some boolean meaning from it, you are going to have to decide which is true and what isn't because it's not an inherent property of the value. You say that it answers the question "Are there any errors?", but that's just one possible boolean interpretation of the status code. That said, I don't know of a shell that doesn't interpret zero status as true, because true(1) and false(1) in Unix returns status zero and non-zero respectively. It's not just Unix, it's Windows, DOS etc. In that sense, the prevalent boolean interpretation is that it answers the question "Did the process end with a success status code?", the exact opposite of what you think. That you or anyone else finds bash or this boolean interpretation in general unintuitive is besides the point, and ignoring that I've already said half of this to complain about bash is a pretty rude way to short-circuit a discussion.