zsh-users
 help / color / mirror / code / Atom feed
* How to print the trapped command for a specific signal
@ 2018-12-03  2:21 Peng Yu
  0 siblings, 0 replies; only message in thread
From: Peng Yu @ 2018-12-03  2:21 UTC (permalink / raw)
  To: zsh-users

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-03  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03  2:21 How to print the trapped command for a specific signal Peng Yu

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).