#!/bin/bash PASSWORD='Ml\$SRpnh##MrOo4' #REMOTEDIR=`date "+%Y%m%d%H%M%S"` LOCALDIR=$1 FILENAME=$2 REMOTEDIR=$3 echo ${REMOTEDIR} expect -c " set timeout 7200 spawn sftp -P 43622 sftpadmin@vpn823121306.softether.net expect \"password:\" send ${PASSWORD}\n expect \"sftp>\" send \"cd PleasanterBackup\n\" expect \"sftp>\" send \"mkdir ${REMOTEDIR}\n\" expect \"sftp>\" send \"cd ${REMOTEDIR}\n\" expect \"sftp>\" send \"lcd ${LOCALDIR}\n\" expect \"sftp>\" send \"put ${FILENAME}\n\" expect \"sftp>\" send \"quit\n\" interact "