On Wed, Aug 11, 2021 at 08:00:12PM -0400, Franklin, Jason wrote: > This doesn't work unless it was recently fixed. A variation does... > > bash-5.0$ echo $BASH_VERSION > 5.0.17(1)-release > bash-5.0$ GROUPS=FOO bash -c 'echo $GROUPS' > 1000 > bash-5.0$ GROUPS=FOO bash --posix -c 'echo $GROUPS' > 1000 > bash-5.0$ env GROUPS=FOO bash -c 'echo $GROUPS' > FOO > bash-5.0$ env GROUPS=FOO bash --posix -c 'echo $GROUPS' > FOO
You can't overwrite GROUPS while you're inside of bash, apparently not even in the temporary assignment context before a simple command. So, in order for the first form to work as expected, you'd have to be in a shell other than bash. unicorn:~$ ksh $ GROUPS=FOO bash -c 'echo "$GROUPS"' FOO And so on. Either that, or unset GROUPS first.