屹洋屹可  

#!/bin/bash
param_file=$1 # 源数据在命令行中指定
code_dir="/data/mypara"

for line in `cat $param_file`;
do
expect -c "
set timeout 5;
spawn ssh root@${line} \"rm -rf /data/mypara;cd /data/;git clone http://jiazhuang:mima@123.git;cd /data/mypara;sh build_local.sh\"
expect {
yes/no { send \"yes\r\"; exp_continue }
*assword* { send \"mypassword\r\" }
} ;
expect eof ;
"
done

posted on 2019-08-03 13:48  屹洋屹可  阅读(268)  评论(0)    收藏  举报