Posted to tcl by DomeMaster at Wed May 28 17:49:45 GMT 2014view raw

  1. #!/usr/bin/expect
  2. set timeout 20
  3.  
  4. spwan sshpass -ppassword ssh username@192.168.1.1
  5.  
  6. expect {
  7. -re "username" { send "echo yay && sleep 5\n" }
  8. timeout { send "echo nay && sleep 5\n" }
  9. }
  10.  
  11. expect {
  12. -re "username" { exit }
  13. }