Unix/Linux code to test whether “today” is a weekend day (or weekday)

If you ever need an example of a Unix/Linux shell script where you need to determine whether today is a weekend day, I can confirm that this code works:

# like "SAT" or "SUN"
dayName=`date +%a | tr '[:lower:]' '[:upper:]'`

if [ $dayName = "SAT" -o $dayName = "SUN" ]
    echo "WEEKEND"
    echo "other"

That code results in dayName being something like SAT or SUN, so the if/then test prints whether “today” is a weekend day or not. The tr command converts the output from the date command to uppercase. That isn’t completely necessary, but if you don’t use it, you have to test again the strings Sat or Sun, so I prefer it in this case. This code will work under both the Bourne and BASH shells.