expect用法

for f in `ls $path_from_10g/$dump_name oracle` rem 获取目录下所有指定文件
do
if [[ $f = $path_from_10g* ]] ;then rem jenkins下执行会有奇怪的连接信息,排除这些连接信息
/usr/bin/expect <<-EOF rem expect 安装目录
spawn scp -r $f oracle@$ip_to_10g:$path_to_10g
expect "password" rem 交互时的提示语行
set timeout 1000 rem 设置超时时间
send "$password rem 输入交互时的密码
"
set timeout 3000
expect eof
EOF
printf $f
fi
done

posted @ 2016-10-25 16:00  雾火  阅读(204)  评论(0编辑  收藏  举报