I am trying to get a script to write to a log file so I setup the script like so:
#! /bin/bash
LOG=/home/ammullan/daily.log
# Cleanup files
if [ -a $LOG ] ; then
rm $LOG
fi
# Main report header
echo "Daily Report for $HOSTNAME for" `date '+%A, %B %d %Y'`"." >> $LOG
echo "********************************************" >> $LOG
echo >> $LOG
# OS header
echo "Current Operating System" >> $LOG
echo "********************************************" >> $LOG
uname -sr >> $LOG
echo >> $LOG
# Uptime Header
echo "Uptime" >> $LOG
echo "********************************************" >> $LOG
uptime >> $LOG
echo >> $LOG
BUT...
It keeps coming up with the following error:
./good_log: line 20: $LOG: ambiguous redirect
./good_log: line 21: $LOG: ambiguous redirect....
Can anyone help? I know that if I just replaced $LOG with /home/ammullan/daily.log it would work but if I decide to change my UN it would be a pain in the butt

Thanks in advance