2 ms·
I disagree. set -eu should be at the top of every bash script. This is the classic braceless if-guard mistake; leave it out today because you don't need it, fo
by nothrabannosir 10y ago
I disagree. set -eu should be at the top of every bash script.
This is the classic braceless if-guard mistake; leave it out today because you don't need it, forget, add something tomorrow and it breaks.
- switch007 10y agoYou can over-rely on "set -e" however: #!/usr/bin/env bash set -e fail() { false ; echo hello; } if ! fail; then :; fi That outputs "hello" and exits with 0.