Posted to tcl by aspect at Tue Sep 09 11:31:59 GMT 2008view raw

  1. package require Expect
  2.  
  3. spawn bash
  4. send "PS1='EXPECT\$ '\n"
  5.  
  6. puts "Use +/_ to alter the timeout, control-D to exit"
  7.  
  8.  
  9. set time 1
  10. while {1} {
  11. puts "Timeout is: $time"
  12. interact {
  13. timeout $time { puts "tick" }
  14. + { incr time; return }
  15. -- - { incr time -1; return }
  16. \004 {
  17. send "exit\n"
  18. break
  19. }
  20. }
  21. }
  22.  
  23. puts "Phew, that's over"
  24.  

Comments

Posted by aspect at Tue Sep 09 11:59:22 GMT 2008 [text] [code]

package require Expect spawn bash send "PS1='EXPECT\$ '\n" puts "Use +/- to alter the timeout, control-D to exit" set time 1 while {1} { puts "Timeout is: $time" interact { timeout $time { puts "tick" } + { incr time; return } -- - { incr time -1; return } -o eof { puts "We're done here" break } } } puts "Phew, that's over"