From: Peng Yu <pengyu.ut@gmail.com>
To: schaefer@brasslantern.com
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: How to trap to script EXIT instead of function EXIT?
Date: Mon, 3 Dec 2018 08:05:34 -0600 [thread overview]
Message-ID: <CABrM6wkMsq9fM28ZQc8uf6gCF270ni7Z4vKxwTL8vGtqr7szDw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YO4MKDardEMtc-2dwSY0N0Nt9vbKd2-n-QiobBOixtaA@mail.gmail.com>
On Mon, Dec 3, 2018 at 1:41 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Sun, Dec 2, 2018 at 8:10 PM Peng Yu <pengyu.ut@gmail.com> wrote:
> >
> > The following example shows that `trap` inside a function is trapped
> > to the function. This behavior is different from bash. Is there a way
> > to make it the same as bash?
>
> setopt posixtraps
>
> Or more generally, "emulate sh".
Thanks.
If function f1 calls function f2, I want to call trap in f2 which
actually set the trap for f1. Is it possible?
--
Regards,
Peng
next prev parent reply other threads:[~2018-12-03 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 4:09 Peng Yu
2018-12-03 7:41 ` Bart Schaefer
2018-12-03 14:05 ` Peng Yu [this message]
2018-12-03 14:59 ` Peter Stephenson
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=CABrM6wkMsq9fM28ZQc8uf6gCF270ni7Z4vKxwTL8vGtqr7szDw@mail.gmail.com \
--to=pengyu.ut@gmail.com \
--cc=schaefer@brasslantern.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).