bug-bash
[Top][All Lists]
Advanced

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

Re: slight OT: shell-script programing style -- origins and change?


From: Stephane CHAZELAS
Subject: Re: slight OT: shell-script programing style -- origins and change?
Date: Sun, 25 Oct 2009 19:25:35 +0000 (UTC)
User-agent: slrn/pre1.0.0-11 (Linux)

2009-10-25, 12:05(-07), Linda Walsh:
> This is not exactly bash specific, but I was looking at a shell script 
> recently and they use the age old convention of using upper case 
> names for all their shell variables.
[...]

By convention, _environment_ variables are upper-case, which helps
in a shell script to distinguish them with ordinary variables. I
would consider shell scripts with all upper-case variables to be
poorly written, and I agree with the fact that it looks like
yelling and is less easy to read.

It's OK to use upper-case for environment variables as you
generally want to have the environment as small as possible.

> What do others think, (or is there a better venue for this 
> question?)  

The comp.unix.shell newsgroup would be the best place.

> I thought I 'd ask here first, since bash seems to be
> the most advanced and most widely used descendent of the original
> Bourne shell, and those most interested in that shell might be
> on this list...but that could easily be a misperception on my part.
[...]

I wouldn't say it's not the most advanced (compared to zsh and
maybe ksh93), but it's more stable than those 2, and more
focused than zsh on being standard conformant, and have fewer
design awkardnesses than ksh93 (though it did copy a lot from
that shell).

It's also the official shell of the GNU project, which is
probably the main reason for its popularity (as that means it's
installed by default on GNU systems and most often the default
user's interactive shell and "sh" implementation there).

-- 
St├ęphane


reply via email to

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