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

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