Make your Bash scripts detect more errors, add this line early in a script:
`set -eu -o pipefail`
`set -e` makes the script fail if a command exits with a non-zero exit status.
`set -u` lets the script fail when you're trying to use not yet defined variables.
`set -o pipefail` will pass on the error from a failed piped command, e.g. `false | true` will then fail, where it would have succeeded otherwise. This one is not available in dash, but in busybox' ash it is.
Yes, shellcheck is a great tool. I'm using it via syntastic in vim.
chaos.social - because anarchy is much more fun with friends.
chaos.social is a small Mastodon instance for and by the Chaos community surrounding the Chaos Computer Club. We provide a small community space - Be excellent to each other, and have a look at what that means around here.
Follow @ordnung for low-traffic instance-related updates.
The primary instance languages are German and English.