4 ms·
I think you answered your own question. Those `if` constructs are indeed clunky. In fact I'd venture to say it's really just "C-like language Stockholm syndrome
by rcoveson 6y ago
I think you answered your own question. Those `if` constructs are indeed clunky. In fact I'd venture to say it's really just "C-like language Stockholm syndrome" that makes them feel more "maintainable" or "clear".
The bash "or" syntax reads very clearly. Do X or do Y. Do X or fail like so. It's very English-like and intuitive. And understanding why it works is just a matter of understanding logical operator short circuiting, which you have to understand to work in C-like languages anyway.
- kazinator 6y agoProblem is you have to fork subshells if here is any sequencing involved. Compare if condition ; then command1 command2 else command3 command4 fi versus: condition && (command1; command2) || (command3; command4) GNU Bash has a fix for that: non-forking braces.
- deleted 6y ago[deleted]