bashstyle
bashstyle copied to clipboard
Using defaults and "${VAR:?}"
If you don't assert the existence of certain important variables, your script could inadvertently wipe the user's home directory:
https://github.com/ValveSoftware/steam-for-linux/issues/3671
https://news.ycombinator.com/item?id=8896186
There's also set -u
I generally don't like set -u, but I do like "${foo:?}" when needed.
I'm not into set -u either, but it's worth noting for people who want to write their own style guides. (It's also worth noting as a "critical section" wrapper that can be paired with set +u.)