Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix FTP script won't run, is not matched error

Status
Not open for further replies.

SuaveRick

Programmer
Apr 12, 2004
142
CA
Hi there, I need to write a script to ftp a number of files down to a local machine from our unix server. Here is what I have so far, by my understanding, it should work (this is the format of it anyway):

ftp -n $destination << EOF
user lemmein thisword
binary
put some file where it needs to go
quit
EOF

I get the error: ftp.sh[8]: Syntax error at line 10 : `<<' is not matched.

Do I have to set something up in the background?? I must be missing something simple.

Thanks!!
 
You have a space AFTER the '<<'
ftp -n $destination << EOF

remove the space to make it '<<EOF'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I tried that but I think the problem is that it's in an if statement because when I run it outside of the if it works...

bdf|grep "opt/cti" > space.dat
space=`awk '{print $5}' < space.dat`
echo $space > space2.dat
space2=`cut -c 1-2 space2.dat`
echo "Last run on `date`" > lastrun.log
#
if [ $space2 -gt 19 ]
then
ftp -in xxx.xxx.xxx.xxx <<EOF
user something somepass
quit
EOF
fi

What the heck? I'm purplexed....
 
either:
1. move the [bold]closing[/bold] EOF to the beginning of the line

OR

2. use '<<-EOF' for the beginning of the block AND make sure there's a TAB before the closing 'EOF'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
PERFECT! vgersh99, I tip my hat to you, excellent help. Something so simple yet causing so much hassle.

I hope you have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top