ssh 脚本登陆
时间:2009-05-19 来源:syfan
#!/usr/bin/expect
set PASSWD [lindex $argv 1] set IP [lindex $argv 0]
set PASSWD [lindex $argv 0]
set COMM [lindex $argv 2]
for { set i 1 } { $i <= 100 } { incr i } {
spawn ssh 192.168.0.98 "echo 2222$i"
expect "(yes/no)?" {
send "yes\r"
expect "password:"
send "$PASSWD\r"
} "password:" {send "$PASSWD\r"}
expect eof
}
set PASSWD [lindex $argv 1] set IP [lindex $argv 0]
set PASSWD [lindex $argv 0]
set COMM [lindex $argv 2]
for { set i 1 } { $i <= 100 } { incr i } {
spawn ssh 192.168.0.98 "echo 2222$i"
expect "(yes/no)?" {
send "yes\r"
expect "password:"
send "$PASSWD\r"
} "password:" {send "$PASSWD\r"}
expect eof
}
相关阅读 更多 +