shell script for ftp
|
Original Message
|
Name: Bob
Date: October 21, 2002 at 17:11:46 Pacific
Subject: shell script for ftpOS: redhat80CPU/Ram: 256 |
Comment: How can I write a shell script which do the ftp to host without promt for user/password... thanks
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: David Perry
Date: October 21, 2002 at 18:51:51 Pacific
|
Reply: (edit)#! /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.
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: David Perry
Date: October 21, 2002 at 19:02:17 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: chupacabra
Date: October 22, 2002 at 14:10:42 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Matt
Date: November 7, 2002 at 03:12:32 Pacific
|
Reply: (edit)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...
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: