blob: b36156462d50876a105483ba3609cab86f264f49 [file] [log] [blame]
Jari Aaltod166f041997-06-05 14:59:13 +00001subshell exit
2trap -- 'echo exiting' EXIT
3trap -- 'echo aborting' SIGHUP
4trap -- 'echo aborting' SIGINT
5trap -- 'echo aborting' SIGQUIT
6trap -- 'echo aborting' SIGABRT
7trap -- 'echo aborting' SIGTERM
Jari Aaltod166f041997-06-05 14:59:13 +00008[20] debug
Jari Aalto7117c2d2002-07-17 14:10:11 +00009debug line
Jari Aaltod166f041997-06-05 14:59:13 +000010[22] debug
Jari Aaltod166f041997-06-05 14:59:13 +000011trap -- 'echo exiting' EXIT
12trap -- 'echo aborting' SIGHUP
13trap -- 'echo aborting' SIGINT
14trap -- 'echo aborting' SIGQUIT
15trap -- 'echo aborting' SIGABRT
16trap -- 'echo aborting' SIGTERM
17trap -- 'echo [$LINENO] debug' DEBUG
Jari Aalto7117c2d2002-07-17 14:10:11 +000018[24] debug
19func[16] funcdebug
20funcdebug line
Jari Aaltod166f041997-06-05 14:59:13 +000021[26] debug
22trap -- 'echo exiting' EXIT
23trap -- 'echo aborting' SIGHUP
24trap -- 'echo aborting' SIGINT
25trap -- 'echo aborting' SIGQUIT
26trap -- 'echo aborting' SIGABRT
27trap -- 'echo aborting' SIGTERM
Jari Aalto7117c2d2002-07-17 14:10:11 +000028trap -- 'echo [$LINENO] debug' DEBUG
29[28] debug
30./trap.tests[33] debug
31./trap.tests[34] debug
Jari Aaltob80f6442004-07-27 13:29:18 +000032func2[30] debug
Jari Aalto7117c2d2002-07-17 14:10:11 +000033func2[31] debug
34func2debug line
35./trap.tests[36] debug
36./trap.tests[38] debug
37trap -- 'echo exiting' EXIT
38trap -- 'echo aborting' SIGHUP
39trap -- 'echo aborting' SIGINT
40trap -- 'echo aborting' SIGQUIT
41trap -- 'echo aborting' SIGABRT
42trap -- 'echo aborting' SIGTERM
Jari Aaltod166f041997-06-05 14:59:13 +000043trap -- '' DEBUG
44trap -- 'echo exiting' EXIT
45trap -- 'echo aborting' SIGHUP
46trap -- 'echo aborting' SIGINT
47trap -- 'echo aborting' SIGQUIT
48trap -- 'echo aborting' SIGABRT
49trap -- 'echo aborting' SIGTERM
50trap -- 'echo exiting' EXIT
51trap -- '' SIGINT
52trap -- 'echo aborting' SIGQUIT
53trap -- 'echo aborting' SIGABRT
54trap -- 'echo aborting' SIGTERM
Jari Aalto28ef6c32001-04-06 19:14:31 +0000550
Chet Ramey495aee42011-11-22 19:11:26 -050056trap -- '' SIGUSR2
Jari Aaltof73dda02001-11-13 17:56:06 +000057ERRTRAP
58ERRTRAP
59ERRTRAP
60after falses
61if negation ok
62after negation
63after while
64before false in trap2a.sub
65after false in trap2a.sub
66command substitution
Chet Ramey00018032011-11-21 20:51:19 -050067+[6] echo 1
681
69+[7] echo 2
702
71+[8] echo 3
72+[8] cat
73+[8] false
74++[8] echo trap: 8
75trap: 8
76+[9] echo 4
774
Chet Rameyac50fba2014-02-26 09:36:43 -050078exit subshell 1
79current shell
80exit subshell 2
81current shell
82current shell
83current shell
84outside 1
85outside 2
86outside 3
87outside 4
88sleep 2
89wait $!
90exit
91in trap EXIT
92sleep 2
93wait $!
94exit
95in trap EXIT
Chet Ramey00018032011-11-21 20:51:19 -050096caught a child death
97caught a child death
Jari Aaltod166f041997-06-05 14:59:13 +000098caught a child death
Jari Aaltod166f041997-06-05 14:59:13 +000099trap -- 'echo caught a child death' SIGCHLD
Jari Aaltocce855b1998-04-17 19:52:44 +0000100trap -- 'echo exiting' EXIT
101trap -- 'echo aborting' SIGABRT
102trap -- 'echo caught a child death' SIGCHLD
103trap -- '' SIGUSR2
Jari Aaltod166f041997-06-05 14:59:13 +0000104exiting