I run across many shell scripts with variables in all caps, and I've always thought that there is a severe misunderstanding with that. My understanding is that, by convention (and perhaps by necessity long ago), environment variables are in all-caps.
But in modern scripting environments like Bash, I have always prefered the convention of lower-case variables for temporary variables, and upper-case variables only for exported (i.e. environment) variables. For example:
echo "It is $year."
By convention, environment variables (
EDITOR, ..) and internal shell variables (
BASH_VERSION, ..) are capitalized. All other variable names should be lower case.
Remember that variable names are case-sensitive; this convention avoids accidentally overriding environmental and internal variables.
Keeping to this convention, you can rest assured that you don't need to know every environment variable used by UNIX tools or shells in order to avoid overwriting them. If it's your variable, lowercase it. If you export it, uppercase it.