给多主机传输文件脚本

#!/bin/bash
for i in 192.168.30.{22..23}
do
/usr/bin/expect <<-EOF
        spawn scp /root/99.sh root@$i:/root
        expect {
                "yes/no" { send "yes\r";exp_continue }
                "password" { send "666666\n" }
        }
        expect eof
EOF
done


posted @ 2019-05-18 10:08  #赵程#  阅读(163)  评论(0编辑  收藏  举报