通常
#!/bin/sh
FTP=/usr/bin/ftp
FTP_OPTION='-i -v -n'
LOGDIR=/var/log
LOG_FILE=$LOGDIR/ftp.log
REMOTE_HOST=example.com
REMOTE_USER=xxxxxxxx
REMOTE_PASSWORD=xxxxxxxx
REMOTE_PATH=path/to/file
REMOTE_FILE=download.file
LOCAL_PATH=/path/to/download
$FTP $FTP_OPTION $REMOTE_HOST << __END__ >> $LOG_FILE
user $REMOTE_USER $REMOTE_PASSWORD
cd $REMOTE_PATH
lcd $LOCAL_PATH
binary
get $REMOTE_FILE
bye
__END__
Firewall超え
#!/bin/sh
FTP=/usr/bin/ftp
FTP_OPTION='-i -v -n'
LOGDIR=/var/log
LOG_FILE=$LOGDIR/ftp.log
PROXY_HOST=proxy
REMOTE_HOST=example.com
REMOTE_USER=xxxxxxxx
REMOTE_PASSWORD=xxxxxxxx
REMOTE_PATH=path/to/file
REMOTE_FILE=download.file
LOCAL_USER=xxxxxxxx
LOCAL_PASSWORD=xxxxxxxx
LOCAL_PATH=/path/to/download
echo $FTP $FTP_OPTION $REMOTE_HOST
$FTP $FTP_OPTION $REMOTE_HOST << __END__ >> $LOG_FILE
user $REMOTE_USER@$LOCAL_USER@$REMOTE_HOST@$REMOTE_HOST
$REMOTE_PASSWORD@$LOCAL_PASSWORD
cd $REMOTE_PATH
lcd $LOCAL_PATH
binary
get $REMOTE_FILE
bye
__END__