[Gllug] ADVERT: Shell Scripting book

Steve Parker steve at steve-parker.org
Wed Jul 20 20:29:53 UTC 2011


On 20/07/11 00:05, Tethys wrote:
> Steve Parker writes:
>
>    
>> Java tendsToInsertCapsLikeThis, which I find veryIrritatingIndeed.
>>      
> Yep, I completely agree there. I guess it's just what you're used to,
> but there is a long standing convention of using upper case only for
> environment variables. That's how it was when I learned scripting a
> quarter of a century ago, and old habits are hard to break, so I've
> stuck with it :-)
>    
All shell variables are environment variables; some, like $REPLY, 
$RANDOM, $SHELLOPTS it would be silly to write to; $HISTTIMEFORMAT, 
$HOSTFILE, $LANG, $PATH, $TIMEFORMAT and others all exist with the 
express purpose that you set them to whatever suits your needs.

So I suppose that you meant system reserved variables, although bash 
supports $auto_resume and $histchars at least, and ksh has a few $.sh_ 
variables too. Like Nix said, I tend to use uppercase for things like 
global variables, things that would be const in C, but I must admit that 
I probably define more uppercase variables than lowercase in shell scripts.
--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list