Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


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

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


# Cleanup files
if [ -a $LOG ] ; then
rm $LOG

# 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

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
LQ Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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.


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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:39 PM.

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