Hello. I often use "set -eu" to make my scripts more robust by exiting when there are errors.
But one of my scripts just kept on running after failures. I found out that the keyword "local" does not obey it. Here is a script to reproduce the problem: #!/bin/bash set -eu failure() { echo "going to fail" false } cmd-subst-failure-with-local() { echo "calling failure without failing because of local" local FAILUREOUT=$(failure) echo "Bug: set -eu wasn't effective: failure output was '$FAILUREOUT'" } cmd-subst-failure-without-local() { echo "calling failure so it fails (without local)" FAILUREOUT=$(failure) # here set -eu works so we will fail instead of getting here echo "Internal error, set -eu didn't work even without local" } cmd-subst-failure-with-local cmd-subst-failure-without-local