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

Re: How to trap to script EXIT instead of function EXIT?



On Mon, Dec 3, 2018 at 1:41 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Dec 2, 2018 at 8:10 PM Peng Yu <pengyu.ut@xxxxxxxxx> 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



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