给多主机传输文件脚本

#!/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 ";exp_continue }
                "password" { send "666666 " }
        }
        expect eof
EOF
done


原文地址:https://www.cnblogs.com/zc1741845455/p/10884800.html