#!/bin/bash #set -e -E trap "echo time to die!" ERR echo "Now running wrong command from the same shell (trap expected)" nocommand echo "Exit value is $?" echo "Now running wrong command a subshell (trap expected, but is not firing)" ( nocommand ) echo Exit value is $? echo "But the run continued..."