4 trap 'echo aborting' 1 2 3 6 15
6 # make sure a user-specified subshell runs the exit trap, but does not
7 # inherit the exit trap from a parent shell
8 ( trap 'echo subshell exit' 0; exit 0 )
15 trap 'echo ${FUNCNAME:-$0}[$LINENO] funcdebug' DEBUG
19 trap 'echo [$LINENO] debug' DEBUG
28 trap 'echo ${FUNCNAME:-$0}[$LINENO] debug' DEBUG
53 # exit 0 in exit trap should set exit status
62 # hmmm...should this set the handling to SIG_IGN for children, too?
70 # show that setting a trap on SIGCHLD is not disastrous.
74 trap 'echo caught a child death' SIGCHLD
76 sleep 7 & sleep 6 & sleep 5 &
82 # Now reset some of the signals the shell handles specially back to
83 # their default values (with or without the SIG prefix)
84 trap - SIGINT QUIT TERM