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