Posted to tcl by mjanssen at Fri Oct 23 14:09:39 GMT 2009view raw

  1. set prompt "#"
  2.  
  3. expect {
  4.  
  5. -re ".*Are.*.*yes.*no.*" {
  6. send "yes\r"
  7. exp_continue
  8. #look for the password prompt
  9. }
  10.  
  11. $prompt {
  12. puts "Login succeeded"
  13. exit 0
  14. }
  15.  
  16. "again." {
  17. puts stderr "Could not login"
  18. exit 7
  19. }
  20.  
  21. "password:" {
  22. send -- "dummy"
  23. send -- "\r"
  24. exp_continue
  25. }
  26.  
  27. }
  28.  

Comments

Posted by krish at Fri Oct 23 14:13:29 GMT 2009 [text] [code]

"password:" { send -- "dummy" send -- "\r" exp_continue } "Permission denied" { exit 7 }