Hi all, I'm noticing some odd behavior in an ERR trap with errtrace. It's present in bash 3.2 and as well as 4.2. The simplest reproduction is as follows:
------8<---------------------- #!/bin/bash somefunc() { false echo "shouldn't see this" } set -E trap -- 'return 1' ERR somefunc echo "should see this" ------8<---------------------- Both versions of bash throw an error, though fwiw the line number differs: bash4 blames the line of where the trap is fired versus bash3 which blames the line where the trap is declared. The entire output of the script is: foo: line 4: return: can only `return' from a function or sourced script should see this So, both versions give the intended behavior of returning from the function despite the error. imo, there's a bug here somewhere, I'm just not sure if it's the faulty error being thrown or if I shouldn't be expecting the trap to work as it is when it's declared outside of a function. Regards, Dave