Linux 下自动登录的脚本
#!/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
}