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

  1. #!/usr/bin/expect -f
  2.  
  3. set timeout 5
  4.  
  5. set no_shell_error {
  6. puts ""
  7. puts "error: couldn't get to the shell"
  8. exit 1
  9. }
  10.  
  11. spawn telnet kaon69
  12. expect ".* login:"
  13. send "root\r"
  14. expect {
  15. timeout $no_shell_error
  16. "# "
  17. }
  18. send "uname -a\r"
  19. expect "# "
  20. send "exit\r"
  21. expect eof
  22.