[Top][All Lists]

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

Re: "sh -a" sets the POSIXLY_CORRECT *environment* variable

From: Chet Ramey
Subject: Re: "sh -a" sets the POSIXLY_CORRECT *environment* variable
Date: Wed, 15 Aug 2018 11:05:06 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 8/14/18 11:50 AM, Stephane Chazelas wrote:
> Hi,
> This is from
> https://unix.stackexchange.com/questions/462333/why-does-a-in-bin-sh-a-affect-sed-and-set-a-doesnt
> (original investigation by Mark Plotnick)
> Though not documented, enabling the POSIX mode in bash whether
> with
> - bash -o posix
> - sh
> - env SHELLOPTS=posix bash
> - set -o posix # within bash
> causes it to set the value of the $POSIXLY_CORRECT shell
> variable to "y" (if it was not already set)

Yes. This behavior dates from early 1997. It was put in on request so users
could get a posix environment from the shell, since GNU utilities
understand the POSIXLY_CORRECT variable. I could improve the documentation
there, but a 20-plus-year-old feature isn't going to change.

``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/

reply via email to

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