LinuxQuestions.org
Have you heard the LinuxQuestions.org Podcast?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This 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
 
Thread Tools
Old 09-28-2003, 11:40 PM   #1
AMMullan
Member
 
Registered: Sep 2003
Location: New Zealand
Distribution: Ubuntu Dapper
Posts: 434
Thanked: 0
Ambiguous Redirect Error


[Log in to get rid of this advertisement]
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 11:42 PM..
AMMullan is offline     Reply With Quote
Old 10-01-2003, 09:39 PM   #2
DavidPhillips
LQ Addict
 
Registered: Jun 2001
Location: South Alabama
Distribution: RedHat / SuSE
Posts: 7,150
Thanked: 0
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 09:49 PM..
DavidPhillips is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 Off
HTML code is Off


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


All times are GMT -5. The time now is 11:13 AM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration