Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

How to trap EXIT like in bash



Hi,

in Bash `trap "echo trapped" EXIT` will trigger when the script 
terminates normally and on SIGINT, SIGTERM, and SIGHUP.

In Zsh, `trap "echo trapped" EXIT` triggers only on normal exit, but 
`trap "echo trapped" EXIT INT` will actually trigger twice on Ctrl-C.

How can I trap normal exit, Ctrl-C, SIGTERM and SIGHUP so trap 
function will only run once?

Thorsten



Messages sorted by: Reverse Date, Date, Thread, Author