Version 6 of An example wherein Expect controls a pager

Updated 2006-07-18 18:21:20

[Explain context, how it illustrates use of exp_continue, ...]

  package require Expect

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

  log_user 0

  spawn more $example_textfile

  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."
                      }