In bash, we can use the && operator to execute two commands. For example:
./foo && ./bar
Will first execute foo, and only if foo is “successful”, it will then execute bar. However, this seems counter-intuitive when you consider that C programs, by convention, return 0 or exit(0) upon successful completion, which runs counter-intuitive to the behavior of the && operator. (Since in most languages, 0 is considered to be a ‘falsey’, and thus would stop the second statement from executing.) What am I missing?
You’re not missing anything. You just have to keep in mind that
trueandfalsearen’t fundamental concepts in the shell.successandfailureare.