Re: using the variable name, GROUPS, in a read list

2012-03-07 Thread Bob Proulx
Greg Wooledge wrote: > Jim Meyering wrote: > > Is there a moral here, other than to avoid using special variable names? > > Probably to prefer lower-case variable names. > > You've nailed it. Or more precisely, avoid all-upper-case variable names, > because they tend to collide with environment v

Re: using the variable name, GROUPS, in a read list

2012-03-07 Thread Roman Rakus
On 03/07/2012 04:54 PM, Jim Meyering wrote: FYI, if I attempt to read into the built-in array variable, GROUPS, this doesn't work: $ bash -c 'while read GROUPS; do echo $GROUPS; done< /etc/passwd'|wc -l 0 Comparing with dash, I see what the author expected, i.e., that the while loop iter

Re: using the variable name, GROUPS, in a read list

2012-03-07 Thread Greg Wooledge
On Wed, Mar 07, 2012 at 04:54:14PM +0100, Jim Meyering wrote: > Is there a moral here, other than to avoid using special variable names? > Probably to prefer lower-case variable names. You've nailed it. Or more precisely, avoid all-upper-case variable names, because they tend to collide with envi

using the variable name, GROUPS, in a read list

2012-03-07 Thread Jim Meyering
FYI, if I attempt to read into the built-in array variable, GROUPS, this doesn't work: $ bash -c 'while read GROUPS; do echo $GROUPS; done < /etc/passwd'|wc -l 0 Comparing with dash, I see what the author expected, i.e., that the while loop iterates once per line in /etc/passwd: $ dash -c