[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2.05 change - bug or feature?
From: |
Chet Ramey |
Subject: |
Re: 2.05 change - bug or feature? |
Date: |
Tue, 30 Oct 2001 09:06:40 -0500 |
> Create the following shell script:
> func() {
> echo $var
> }
> var=xxx func
> func
> var=yyy func
>
> When run on bash 2.04, this produces
>
> xxx
>
> yyy
>
> When run on bash 2.05, it produces
>
> xxx
> xxx
> yyy
>
>
> Bug or feature?
Feature. POSIX.2, section 3.9.5, says:
When a function is executed, it shall have the syntax-error and
variable-assignment properties described for special built-in
utilities in the enumerated list at the beginning of 3.14.
Section 3.14 says, in part:
Variable assignments specified with special built-in utilities
shall remain in effect after the built-in completes...
Note that bash behaves this way only when in posix mode.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/