1832864 Members
2905 Online
110048 Solutions
New Discussion

ftp in shell script

 
SOLVED
Go to solution
Kevin Dunn
New Member

ftp in shell script

I am trying to use ftp in a shell script and was getting the ftp prompt (as if it were waiting for a command) after the initial connection to the remote server. I looked at some of the existing forums:
http://forums.itrc.hp.com/cm/QuestionAnswer/0,,0xc7b7d5fab40ed6118ff40090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc88106295e00d6118ff40090279cd0f9,00.html
that gave me some good examples. Here is my code:

ftp -nidv ${FTPIP} < user ${FTPUSER} ${FTPAUTH}
cd ${REMOTEDIR}
lcd ${LOCDIR}
ascii
${FTPCMD1} ${FTPFILEA1} ${FTPFILEB1}
close
bye
EndFTP

Without the <
ftp_exec.ksh[14]: Syntax error at line 16 : `<<' is
not matched.

I'm trying to work my way into Unix from a IBM Mainframe envrionment (or Legacy as it is referenced!!) Any help is appreciated... Thanks!
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: ftp in shell script

I can't quite tell from your posting, but make sure that there are NO spaces between the two < symbols in your code. They must be together.

ftp -nidb 192.192.192.192 << EOF
command
command
command
EOF

Also make sure the your ending EndFTP is not indented at all. It MUST start at column 1 on the line.
James R. Ferguson
Acclaimed Contributor

Re: ftp in shell script

Hi:

The 'EndFTP' must not have leading spaces or tabs.

Regards!

...JRF...
Tom Maloy
Respected Contributor

Re: ftp in shell script

EndFTP can't have any trailing blanks or other characters either...

Tom
Carpe diem!
Kevin Dunn
New Member

Re: ftp in shell script

Thanks everyone!!!!

All get 10 points (see us mainframe guys aren't so bad!) :)

The code was embedded in a function and there was a space in front of the EndFTP. I removed the space and it works!!

Thanks again!