Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How to trap EXIT like in bash
- X-seq: zsh-users 20080
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: How to trap EXIT like in bash
- Date: Sat, 4 Apr 2015 17:20:04 +0200
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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