On 10/14/13 9:51 AM, Akim Demaille wrote:
> Hi!
> 
> I have this weird behavior that I do not understand: when running
> 
>       FOO=1 foo
> 
> I do not expect FOO to remain in the env after foo was invoked, even
> if foo is a shell function.  However it does, _if_ bash is invoked
> in POSIX mode, something which I couldn't find documented in the
> model (and I wouldn't know where to find this information in POSIX).

Yes, Posix requires it.  It's described in the info manual:

 31. Assignment statements preceding shell function calls persist in the
     shell environment after the function returns, as if a POSIX
     special builtin command had been executed.

An extract from the info manual describing Posix mode (the same as the
POSIX file in the bash distribution) is available at

http://tiswww.case.edu/~chet/bash/POSIX

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to