Posted to tcl by aspect at Tue Sep 09 11:31:59 GMT 2008view pretty
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 } \004 { send "exit\n" break } } } puts "Phew, that's over"
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"