trap

trap#

Run a handler on signal / EXIT (built-in).

$ trap 'rm -f "$tmp"' EXIT
$ trap 'echo interrupted; exit 130' INT