News for hackers. Stuff that matters.
Re:Understanding Bash (2018) by banachtarski on Thursday January 16, 2020 @11:53AM (#22066299)
The article is wrong though. For error codes, 0 being a success value is the CONVENTION. A non-zero code is an error. This isn't about "programming languages."
Re:Understanding Bash (2018) by SAI_Peregrinus on Thursday January 16, 2020 @02:07PM (#22067758)
The problem is that for bash `true` is a function (or builtin) that returns 0, while for C (and thus most languages) any non-zero value (typically 1 for the builtins) is true. In c99 and later with stdbool.h, `true` is almost always defined as `#define true 1`.
Re:Understanding Bash (2018) by aidenn0 on Thursday January 16, 2020 @02:50PM (#22068172)
the existence of the && and || operators (not to mention the true and false utilities) would indicate it's more than just a convention.
Re:Understanding Bash (2018) by gbacon on Thursday January 16, 2020 @12:27PM (#22066695)
Wrong is a bit harsh for a convention or semantics, more like imprecisely worded.