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

How to print the trapped command for a specific signal



Hi,

I only see the way to print the trapped commands for all signals. Is
there a way to print the trapped command for a specific signal?
Thanks.

$ cat main.sh
#!/usr/bin/env zsh
# vim: set noexpandtab tabstop=2:

set -v
trap "echo 'Hello World!'" EXIT
trap "echo 'Hello World1!'" ZERR
trap
$ ./main.sh
trap "echo 'Hello World!'" EXIT
trap "echo 'Hello World1!'" ZERR
trap
trap -- 'echo '\''Hello World!'\' EXIT
trap -- 'echo '\''Hello World1!'\' ZERR
Hello World!

-- 
Regards,
Peng



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