Re: exit trap inside ksh-style function in bash-2.05b
From:
Michael Wang
Subject:
Re: exit trap inside ksh-style function in bash-2.05b
Date:
Thu, 25 Sep 2003 12:05:25 -0400
User-agent:
Mutt/1.4i
On Thu, Sep 25, 2003 at 09:31:08AM -0400, Chet Ramey wrote:
> Bash has not `adopted the ksh-style function'. Bash functions conform
> to POSIX.2, regardless of the syntax used to declare them.
>
> POSIX.2 requires that shell functions share the calling shell's
> environment, which includes traps.
The POSIX.2 requires the POSIX style function foo() {...}
share the calling shell's environment, which includes traps.
The requirements do not apply to ksh-style function.
ksh is POSIX.2 compliant, yet has a ksh-style function
different than POSIX style function.
I believe it is very sensible to have a locally scoped
variable and trap. I find it hard to do modular program with
POSIX style function.
I noticed that bash has the locally scoped
variable inside the ksh-style function using "typeset",
I would appreciate to have locally scoped traps as well.
And are you looking into issue #2 in my previous email,
which is ( ... ) and $( ... ) produces different result?
--
Michael Wang * http://www.unixlabplus.com/ * mwang@unixlabplus.com