# An error in a trap action must not disable the trap, and `exit` in a trap # still sets the shell's status. printf '%s\n' "trap 'echo trap ran; \${x?boom}' USR1" 'kill -USR1 $$' \ 'echo a1' 'kill -USR1 $$' 'echo a2' | env PS1= PS2= "$TSH" -i 2>&1 | grep -v -e boom -e 'job control' -e '^$' "$TSH" -c 'trap "exit 3" USR1; kill -USR1 $$; echo after'