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:
#!/bin/bash
year=`date +%Y`
echo "It is $year."
export JAVA_HOME="$HOME/java"
That has always been my take on things. Are there any authoritative sources which either agree or disagree with this approach, or is it purely a matter of style?