4 ms·
The behavior varies with shell: $ cat test_trap trap 'echo exiting' EXIT kill $$ $ bash test_trap exiting Terminated $
by jwilk 9y ago
The behavior varies with shell:
$ cat test_trap
trap 'echo exiting' EXIT
kill $$
$ bash test_trap
exiting
Terminated
$ ksh test_trap
exiting
Terminated
$ mksh test_trap
exiting
$ dash test_trap
Terminated
$ zsh test_trap
Terminated
- eridius 9y agoThis article is specifically about Bash. I'm not surprised that `trap` behavior varies per shell, and I'd recommend reading the documentation on it.