From: Peng Yu <pengyu.ut@gmail.com>
To: zsh-users <zsh-users@zsh.org>
Subject: How to print the trapped command for a specific signal
Date: Sun, 2 Dec 2018 20:21:41 -0600 [thread overview]
Message-ID: <CABrM6wkDoHSPUH+K0+=jmuDYSkqprpaOysQbwvFdgvzcVGrGkw@mail.gmail.com> (raw)
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
reply other threads:[~2018-12-03 2:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABrM6wkDoHSPUH+K0+=jmuDYSkqprpaOysQbwvFdgvzcVGrGkw@mail.gmail.com' \
--to=pengyu.ut@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).