Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14499

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: "sh -a" sets the POSIXLY_CORRECT *environment* variable
Date 2018-08-15 11:05 -0400
Message-ID <mailman.5142.1534345542.1292.bug-bash@gnu.org> (permalink)
References <20180814155026.rr3f52t7six2frsv@chaz.gmail.com>

Show all headers | View raw


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    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: "sh -a" sets the POSIXLY_CORRECT *environment* variable Chet Ramey <chet.ramey@case.edu> - 2018-08-15 11:05 -0400

csiph-web