[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: propagating environment variable via internal command

From: Chet Ramey
Subject: Re: propagating environment variable via internal command
Date: Wed, 20 Jun 2018 10:42:07 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 6/20/18 9:25 AM, Tomáš Čech wrote:
> Hi,
> when comparing strange behaviors of different shell implementations Tomas
> Janousek found this bug
> When using BASH as sh shell...
>  $ ls -l /bin/sh
>  lrwxrwxrwx 1 root root 4 Jun 13 16:25 /bin/sh -> bash
> ...internal shell command `set' propagates environment variable to the
> process its running:
>  $ /bin/sh
>  sh-4.4$ VARIABLE=value set -o noglob
>  sh-4.4$ env | grep VARIABLE
>  VARIABLE=value
>  sh-4.4$

Posix requires this behavior, which dates back to the Bourne shell, for
assignment statements that precede special builtins:


It used to require the same behavior for assignment statements preceding
shell function calls, but that was removed in the most recent update.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]