标签:expect timeout 批量 for ash roo password tin inter
#!/bin/bash
password=Jdyun@2019
for i in {1..3}
do
expect <<-EOF
set timeout 5
spawn ssh-copy-id -i root@jdc$i
expect {
"yes/no" { send "yes\n";exp_continue }
"password:" { send "$password\n" }
}
interact
expect eof
EOF
done
EOF行前后不能有空格
标签:expect timeout 批量 for ash roo password tin inter
原文地址:https://www.cnblogs.com/guoxin1990/p/10905892.html