標籤:des style blog color io 檔案 2014 cti
1 #!/bin/bash - 2 #=============================================================================== 3 # 4 # FILE: ftp_put_file.sh 5 # 6 # USAGE: ./ftp_put_file.sh 7 # 8 # DESCRIPTION: 9 # 10 # OPTIONS: ---11 # REQUIREMENTS: ---12 # BUGS: ---13 # NOTES: ---14 # AUTHOR: linkscue (scue), [email protected]15 # ORGANIZATION: 16 # CREATED: 2014年08月03日 01時14分25秒 CST17 # REVISION: ---18 #===============================================================================19 20 # FTP上傳檔案21 # 依賴於 ncftp 命令22 put_action(){23 srv=$1 # FTP Server Addr24 port=$2 # FTP Server Port25 user=$3 # FTP Client User26 passwd=$4 # FTP Client Passwd27 dir=$5 # 檔案存放目錄28 file=$6 # 需上傳的檔案29 tmp=/tmp/$(basename $0)_$$.txt30 cat <<-EOF >$tmp31 cd $dir32 put $file33 bye34 EOF35 ncftp -u $user -p $passwd $srv $port <$tmp36 rm -f $tmp37 }38 39 put_action 192.168.1.201 21 scue 123 / dropbear.sh