#!/usr/bin/expect
set timeout 60
set host 192.168.1.102
set name root
set password 397953263
spawn ssh $name@$host
expect {
"yes/no" {
send "yes\n";
exp_continue;
}
"password" {
send "$password\n";
send "uname -a\n";
exp_continue;
}
}
expect {
"#" {
send "uname -a\r";
}
}
set timeout 60
set host 192.168.1.102
set name root
set password 397953263
spawn ssh $name@$host
expect {
"yes/no" {
send "yes\n";
exp_continue;
}
"password" {
send "$password\n";
send "uname -a\n";
exp_continue;
}
}
expect {
"#" {
send "uname -a\r";
}
}