All pastes #765034 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-07 19:23 UTC
rendered paste body
#!/usr/bin/expect -f
#
set myarg [lindex $argv 0]
set myexp "\\\["

set filename "input.txt"
set input [open $filename "r"]

gets $input line
puts "from file: = $line"
close $input

proc do_it { exp } {

   global logfile

   puts "do_it: expecting $exp"
   send -- "ls\r"
   expect {
      timeout { puts "timed out!!" }
      $exp
   }
}

puts "myexp:$myexp and argument:$myarg"

set timeout 5
spawn $env(SHELL)
match_max 100000

do_it $line