LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-28-2003, 10:40 PM   #1
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 437

Rep: Reputation: 30
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


Thanks in advance

Last edited by AMMullan; 09-28-2003 at 10:42 PM.
 
Old 10-01-2003, 08:39 PM   #2
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,154

Rep: Reputation: 56
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

Last edited by DavidPhillips; 10-01-2003 at 08:49 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash returns ambiguous redirect with date in filename rstoutmna Programming 5 09-13-2011 07:37 PM
Any one know how to redirect standard error (stderr) to a JetDirect printer? RickMean Linux - General 2 09-03-2004 11:33 AM
Ambiguous output redirect XFox Linux - Newbie 5 10-17-2003 07:29 PM
Ambiguous error messages from fsck, but not from e2fsck jiffydude Linux - Software 2 09-12-2003 06:02 PM
ambiguous redirect? cuss Linux - General 4 03-06-2003 10:58 AM


All times are GMT -5. The time now is 08:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration