LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Automate FTP session using Shell Script (http://www.linuxquestions.org/questions/programming-9/automate-ftp-session-using-shell-script-543982/)

kalyanofb 04-07-2007 05:28 AM

Automate FTP session using Shell Script
 
Friends,

I want to automate a FTP session using shell script. Which is the best way to do this?


How to know whether FTP completed successfully or not?


Thanks to all who are going to give solutions.

KALYANA RAMAN.M

cmnorton 04-07-2007 09:19 AM

one way
 
#!/bin/sh
HOST='nohost'
USER='someuser'
PASSWD='somepwd'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit $?

jlliagre 04-07-2007 09:44 AM

If you don't care having your password showing up in ps output, this should work too:
Code:

wget ftp://$USER:$PASSWD@HOST/$FILE


All times are GMT -5. The time now is 11:13 PM.