Friday, May 2, 2008

How to write a FTP script in BASH Shell

The following is bash script to get files from a FTP server
---------------------------------------------------------------
#!/bin/bash
HOST=ip_address
USER=username
PASSWD=password
FILE=complete file path

ftp -n $HOST << END_SCRIPT
quote USER $USER
quote PASS $PASSWD
get $FILE
quit
END_SCRIPT
---------------------------------------------------------------

No comments:

Post a Comment