Don't write shell scripts
Command substitution errors are silently ignored whenever the substitution occurs in a command:
$ echo $(false); echo $? 0 $ variable=$(false); echo $? 1
Not when setting variables. Course not.
When I say don't write shell scripts, I'm talking mostly about sh and bash, but every shell I've used has fairly arcane rules that need to be followed. The convenience of the shell, its brevity, especially when creating pipelines, is manifested through these rules, but they're numerous and complex enough to regularly trip up and confuse even experienced folk.
After spending years writing shell script - including one >1000 line bash script that has been running in production for ~10 years - I now strongly think that shells, like bash, should only be used interactively, and not for any kind of automation, or even the very thinnest of glue.
The second finest shell script in the universe is a single line long:
exec $something_else
The finest... does not exist.
