Version 3 of An example wherein Expect controls a pager

Updated 2006-07-18 18:17:17

[Explain context.]

  package require Expect

  spawn more /etc/passwd
  set more_prompt "--More-- or (q)uit"
  set more_prompt %)
  set go_ahead_reply " "

  log_user 0

  expect $more_prompt {send $go_ahead_reply
                       puts "The current display is in exp_out(buffer)."
                       exp_continue
                      } eof {
                       puts "That's the end."
                      } timeout {
                       puts "This is strange."
                      }