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 [$LINENO] funcdebug' DEBUG
19 trap 'echo [$LINENO] debug' DEBUG
43 # exit 0 in exit trap should set exit status
52 # hmmm...should this set the handling to SIG_IGN for children, too?
57 # show that setting a trap on SIGCHLD is not disastrous.
61 trap 'echo caught a child death' SIGCHLD
63 sleep 7 & sleep 6 & sleep 5 &
69 # Now reset some of the signals the shell handles specially back to
70 # their default values (with or without the SIG prefix)