#!/bin/bash
cat iplist|while read line #iplist文件中存放了IP地址和密码,每行格式为“IP地址 密码”
do
a=($line) #a为数组
/usr/bin/expect<<EOF
spawn ssh root@${a[0]}
expect {
"*yes/no" { send "yes\r"; exp_continue}
"*password:" { send "${a[1]}\r" }
}
expect "#"
send "hostname\r"
send "exit\r"
expect eof
EOF
done
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
吃饱了闲的