This is due to a bug in bash. During the Command Substitution step in echo $( made up name ) `made` runs (or fails to be found) in a subshell, but the subshell is "optimized" in such a way that it doesn't use some traps from the parent shell. This was fixed in [version 4.4.5](http://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-005): > Under certain circumstances, a simple command is optimized to eliminate a > fork, resulting in an EXIT trap not being executed. With bash 4.4.5 or higher, you should see the following output: error.sh: line 13: made: command not found err status: 127 ! should not be reached ! The trap handler has been called as expected, then the subshell exits. (`set -e` only causes the subshell to exit, not the parent, so that "should not be reached" message should, in fact, be reached.) A workaround for older versions is to force the creation of a full, non-optimized subshell: echo $( ( made up name ) ) The extra spaces are [required](http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03) to distinguish from Arithmetic Expansion.