Script Example for FTP

jsblkly
jsblkly used Ask the Experts™
on
I am writing a korn shell script for a LINUX machine and can not seem to get it right.  I am getting an "unexpected end of file error".

Script excerpt...

ftp -n<<EOF
  open (machine name)
  user (user name) (password)
  put (filename)
  bye
EOF

if [ $? -ne 0 ]
then
  echo "Error in FTP!"
  exit 1
fi

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try doing this:

ftp -nv <<EOF
 open (machine name)
 user (user name) (password)
 put (filename)
 bye
EOF
Commented:
a working sample
ftp -n -v 10.10.10.two  >> LOG_FILE <<  EOL
user ftpid   ftppass
bin
cr
put /tmp/crap
quit
EOL


there is another way..

use netrc
look the manpage for .netrc
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: akshayxx {http:#7467142}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial