Posted to tcl by haole at Mon Sep 22 17:04:09 GMT 2014view pretty

#!/usr/bin/expect -f

set timeout 5

set no_shell_error {
    puts ""
    puts "error: couldn't get to the shell"
    exit 1
}

spawn telnet kaon69
expect ".* login:"
send "root\r"
expect {
    timeout $no_shell_error
    "# "
}
send "uname -a\r"
expect "# "
send "exit\r"
expect eof