shell脚本实现ftp批量上传

#!/bin/sh

hostIP=´10.2.110.110´
serverName=´ftp_110´
password=´123456´

dirName=`pwd|sed 's/\//_/g'|cut -c2-`

if [ $1 = ´all' ];then
ftp -i -n $hostIP <<EOF_FTP
user ${serverName} ${password}
mkdir $fileName
cd $fileName
mput *
quit
EOF_FTP
else 
ftp -i -n $hostIP <<EOF_FTP1
user ${serverName} ${password}
put $1
quit
EOF_FTP1
fi

编程技巧