[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using the variable name, GROUPS, in a read list
From: |
Greg Wooledge |
Subject: |
Re: using the variable name, GROUPS, in a read list |
Date: |
Wed, 7 Mar 2012 11:04:11 -0500 |
User-agent: |
Mutt/1.4.2.3i |
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 environment variables and special shell
variables. Any variable name with at least one lower-case letter should
be safe.
There is an unfortunate long-lived bad habit that's floating around out
there, where people think they're supposed to use all-caps variable names
in shell scripts. That is not a good idea, and you've just stumbled upon
one of the many reasons why.