Computing.Net > Forums > Unix > shell script for ftp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

shell script for ftp

Reply to Message Icon

Name: Bob
Date: October 21, 2002 at 17:11:46 Pacific
OS: redhat80
CPU/Ram: 256
Comment:

How can I write a shell script which do the ftp to host without promt for user/password...

thanks



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: October 21, 2002 at 18:51:51 Pacific
Reply:

#! /bin/sh
echo This will use a "here" document to embed ftp commands in this script
# Begin of "here" document
ftp <<**
open anyserver.anywhere.net
anonymous
mymail@mailserver.net
cd pub
bin
get anyfile.tar.gz
bye
**
# End of "here" document
echo ftp transfer ended.


0

Response Number 2
Name: David Perry
Date: October 21, 2002 at 19:02:17 Pacific
Reply:

Or this example from 'Ben' using parens to nest a subfunction.

Start:
(
echo "user username password"
echo "lcd /tmp"
echo "Yet more ftp cmds"
echo "Yet more ftp cmds"
echo "Yet more ftp cmds"
echo "bye"
) | ftp -vni hostname /tmp/logfile.$$
:end of script
Hope this helps


0

Response Number 3
Name: chupacabra
Date: October 22, 2002 at 14:10:42 Pacific
Reply:

The one script above doesn't work for me....the following one works...

#!/usr/bin/sh
ftp -n << EOF
verbose
open yourhost
user username password
get /tmp/stuff
close
EOF

##chupacabra


0

Response Number 4
Name: Matt
Date: November 7, 2002 at 03:12:32 Pacific
Reply:

Use wget! Wget is non-interactive utility for downloading...

Put something like this in your script:

wget ftp://USER:PASSWORD@ftp.test.dom/pub/filename.tar

That's all...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: shell script for ftp

shell script for sent e-mail www.computing.net/answers/unix/shell-script-for-sent-email/5000.html

shell script for string encryption www.computing.net/answers/unix/shell-script-for-string-encryption/7406.html

shell script for string search www.computing.net/answers/unix/shell-script-for-string-search/5478.html