#!/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

浙公网安备 33010602011771号