[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The correct way to use "for" without polluting the environment
From: |
Chet Ramey |
Subject: |
Re: The correct way to use "for" without polluting the environment |
Date: |
Mon, 09 Mar 2015 09:49:04 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 3/8/15 5:44 PM, Stephane Chazelas wrote:
> BTW, to get back on topic:
>
> $ bash --norc -o posix
> bash-4.3$ unset zzz
> bash-4.3$ zzz=x eval
> bash-4.3$ env | grep zzz
> zzz=x
>
> ksh93, zsh (in sh emulation), dash, mksh, the Bourne shell (the
> port of opensolaris' to Linux at least) do retain the value of
> zzz after eval has returned but don't export it to the
> environment. They don't export it within the evaled code either.
>
> $ ksh -c 'zzz=x eval "env | grep zzz"'
> $
>
> yash behaves like bash.
>
> If I interpret the POSIX spec correctly, the variable should
> *not* be exported in those cases (though it's not very clear):
It's unspecified.
austingroupbugs.net/view.php?id=654
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/