Operating System - HP-UX
1753844 Members
7780 Online
108806 Solutions
New Discussion юеВ

<< UNMATCHED error with << FTPEOF VERY URGENT!!

 
SOLVED
Go to solution
Sander Derix
Occasional Advisor

<< UNMATCHED error with << FTPEOF VERY URGENT!!

Hi group,

I keep getting this error:
2) Check connection FTP server
xx.xxx.xx.xx is alive
./ftp.sh[51]: syntax error at line 55 : `<<' unmatched
What the f#ck is wrong with this?
I copied this from another script wich runs every night, so this should work fine. Why do I get the error?!?!!?!?!? Is it because of the gremlins in my computer?

ftp -nv $2 << FTPEOF # > /tmp/temp_log.$$
user $3 $4
cd $5 #Switch to directory
get $1 #Get file

Sander
17 REPLIES 17
john korterman
Honored Contributor
Solution

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Hi Sander,
you need the string
FTPEOF
in your script to mark the end of the "here-script". It must not be indented.

Hope it helps
John K.
it would be nice if you always got a second chance
steven Burgess_2
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Sander

You need to at the end

bye
EOF

No need for the language mate

Steve
take your time and think things through
steven Burgess_2
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

ie

ftp -inv << EOF
open
user
binary
cd /home/
get .profile
bye
EOF


Steve
take your time and think things through
Robin Wakefield
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

And make sure the final FTPEOF starts at column position 1, no leading spaces allowed.

Rgds, Robin
Sander Derix
Occasional Advisor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Hi guys,

thnx for the reply.

Sorry to say but i've got an EOF!


ftp -nv $2 << FTPEOF # > /tmp/temp_log.$$
user $3 $4
cd $5 #Switch to directory
get $1 #Get file
FTPEOF #End spool

So what else can be the problem?

Sander

steven Burgess_2
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

What about the

bye

Steve
take your time and think things through
Sander Derix
Occasional Advisor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Extra info
I've taken out 1 < before FTPEOF (line no 50 approx.)
In the result you see a line
3) Conection succesfull
I didn't get that when I had <

Here's the entire script:
#-------------
# CONSTANTS
#------------
FILE=$1
SERVER=$2
USERNAME=$3
PASSWORD=$4
FTP_DIR=$5
EMAILADRES=$6 #"sander.derix@office.xerox.com"

#-------------
# LOG
#-------------
LOG=/tmp/$1.log
MSG=/tmp/$1.msg
echo "File transfer $1 to QAD failed" > $MSG

#----------------------------------------------------
echo "1) Checking for an Existing Input File"
cd /tmp
echo "1) Checking for an Existing Input File"
cd /tmp
cp $FILE $FILE-01

echo "2) Check connection FTP server"
#----------------------------------------------------
/usr/sbin/ping ${SERVER} >$LOG
grep -i "alive" $LOG
i=$?
if [ "$i" = "0" ] ; then

echo "3) Conection succesfull"
ftp -inv $SERVER < FTPEOF
user $3 $4
cd $5 #Switch to directory
get $1 #Get file
>> FTPEOF #End spool

if test $? = 0 ; then
cat /tmp/temp_log.$$ >>$MSG
echo ====
echo "FTP of $1 completed successfully."
echo ====
"ftp.sh" 85 lines, 3254 characters
(opbdev1:cpiddvl) /u/appl/sderix/test-> ./ftp.sh .dat xx.xxx.xx.xx ftp>
./ftp.sh: !/bin/ksh: not found
1) Checking for an Existing Input File
2) Check connection FTP server
xx.xxx.xx.xx is alive
3) Conection succesfull
./ftp.sh[54]: FTPEOF: cannot open
./ftp.sh[55]: user: cannot execute
./ftp.sh[56]: /dg03/ftp_get: not found
ERROR [.dat]: not an SCCS file (co1)
cat: cannot open /tmp/temp_log.5928
====
FTP of mf680sfr.dat completed successfully.
====
./ftp.sh[65]: /tmp/mf680sfr.dat.msg: cannot execute
mailnote sent to
The flags you gave are used only when sending mail.
Usage: mailx -eiIUdFntBNHvV~ -T FILE -u USER -h hops -r address
-s SUBJECT -f FILE users
john korterman
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Hi again,

I do not think that it is allowed to have anything but that EOF string on the line - not even a comment.

regards,
John K.
it would be nice if you always got a second chance
Robin Wakefield
Honored Contributor

Re: << UNMATCHED error with << FTPEOF VERY URGENT!!

Hi Sander,

You shouldn't have taken out the "<", that's why you're getting the new errors.

Take out the ">> " before the FTPEOF, and make sure the FTPEOF line is on it's own, starting at column 1.

Rgds, Robin.