Ambiguous Redirect Error
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 :) :study: Thanks in advance |
maybe you could put `user` in the place of your username if you want to replace $LOG
I don't know why it would do what your showing unless there's something in the file you can't see maybe try echo " " >> $LOG in Line 18 |
All times are GMT -5. The time now is 07:43 AM. |