Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How to print the trapped command for a specific signal
- X-seq: zsh-users 23779
- From: Peng Yu <pengyu.ut@xxxxxxxxx>
- To: zsh-users <zsh-users@xxxxxxx>
- Subject: How to print the trapped command for a specific signal
- Date: Sun, 2 Dec 2018 20:21:41 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=2eL0OkNS5u1EBiY8W9kAAccEwbszenBX/AqGWhs4FB4=; b=gk6pPpsLLJZfGNNN8ZBHrNZ95JlUOr21qP/AxfuuSZC5gFNwe80AwKhDxDvJnN85fw mBhYc7HY+N33rbktbydSHdetL+vmUnI9QcKXe+Y6LyI/0h7T1e58Tce6iA+n5Sqd8Re6 tK8nC4aNa7dmJljXVIJQzxCdg5l44+9yqiEuJ8N5xz9zfHpnGAmWfMiwo5gGuw7E5aPY R8n0AJ8A3w9Iag9kG1o06Xo8r7Q4Ln0n+y/DQ7XuqzNRwHDuWpm5VU2hHQnVZ27rnr2E BW7MUC5YVjmM2wK4jOSfeULIVNKTZwqpVtQVxYramxP0+uH7HNnszsP49a6jcN23d6yV JzLQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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