ftp put

#!/bin/ksh
if [ $# -lt 3 ]
then
   echo Usage: $0 hostname directory filename
   echo Note: make sure the machine,login,password has been existed in ${HOME}/.
netrc. 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) }'`
directory=$2

# FTP file
ftp $hostname << EOF 2>&1
prompt off
bin
cd $directory
mput $file
EOF

你可能感兴趣的:(ftp)