abrbpvwelv 发表于 2016-6-7 10:14:42

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
页: [1]
查看完整版本: ftp put