On 8/9/21 5:35 PM, Franklin, Jason wrote: > Greetings: > > I discovered today that the GROUPS variable is special in Bash.
It is. For everyone else: GROUPS An array variable containing the list of groups of which the current user is a member. Assignments to GROUPS have no effect. If GROUPS is unset, it loses its special properties, even if it is subsequently reset. > > I moved some scripts to a new box, and they stopped working. On this > box, /bin/sh linked to /bin/bash instead instead of /bin/dash. > > Scripts of of this form... > > #!/bin/sh > GROUPS='foo bar' > # do something with $GROUPS here > > had worked because GROUPS had no special meaning under /bin/dash. > > The script is invoked with /bin/sh (linked to /bin/bash), so I had > expected Bash POSIX compliance to take over. It did not. POSIX, which does not specify GROUPS, does not make a difference. If you would like this to work on dash and bash, unset GROUPS before trying to assign to it. > Is this considered a bug? It's not. > Should bash, invoked with "--posix" or as "sh", omit the special > treatment of variables such as GROUPS? No. Bash does not try to restrict itself to only those things specified by POSIX. -- ``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/