ftp get

#!/bin/ksh
if [ $# -lt 3 ]
then
    echo Usage: $0 hostname directory filename
    echo Note: make sure the machine,login,password has  existed in ${HOME}/.net
rc. For example:
    echo
    echo machine=zsups315
    echo login=root
    echo password=mypassword
    exit 1
fi

hostname=$1

#get file list
#file=`echo $* | awk '{ for  (i = 3; i <= NF ; i++ )  printf("%s ",$i) }'`
file=$3
directory=$2
echo $file
# FTP file
ftp $hostname << EOF 2>&1
prompt off

bin
cd $directory
mget $file
EOF

 

你可能感兴趣的:(ftp)