# A failed `exec` must still run the EXIT trap, and report "not found" with # status 127 (POSIX 2.8.1: a special built-in that fails exits the shell). "$TSH" -c 'trap "echo bye" EXIT; exec /nonexistent/cmd' 2>&1 | grep -c 'not found' "$TSH" -c 'trap "echo bye" EXIT; exec /nonexistent/cmd' 2>/dev/null echo "status $?"