bug-bash
[Top][All Lists]
Advanced

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

Re: GROUPS


From: Franklin, Jason
Subject: Re: GROUPS
Date: Wed, 11 Aug 2021 21:01:43 -0400
User-agent: Evolution 3.36.5-0ubuntu1

On Wed, 2021-08-11 at 20:36 -0400, Greg Wooledge wrote:
> 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.

Exactly. I had thought that it was partially KRE's point.

bash-5.0$ x=foo
bash-5.0$ x=bar bash -c 'echo $x'
bar
bash-5.0$ echo $x
foo

The above is a reasonable expected behavior that works with "x" but
fails with "GROUPS" and other such magic variables.

The trick of "unset GROUPS" is the only way out.

-- 
Jason Franklin






reply via email to

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