How can I scroll the terminal output with Expect

Hi,

I'm trying to come up with a simple expect script that allows me to login to a system and run a single command ... something like this:

#!/usr/bin/expect -f
# let's set some variables
#set password [lrange $argv 0 0]
set ipaddr [lrange $argv 0 0]
set ponumber [lrange $argv 1 1]
set hostname [lrange $argv 2 2]
set timeout -1
# let's now connect to the system
spawn telnet $ipaddr
match_max 100000
# we now look for the password prompt.
expect "*login:*"
send -- "admin\r"
expect "*assword:*"
send -- "yourpassword_here\r"
log_file /archive/$ponumber/$hostname.txt
expect "MVBLGS11>"
send -- "show config\r"
expect ">"
send -- "exit\r"
expect eof

The problem I have is that the output from a single show command overflows, the display screen is followed by the --More-- prompt. At the --More-- prompt, you have these options:

  • Press Ctrl+C, q, or Q to interrupt the output and return to the command prompt.

  • Press the spacebar to display an additional screen of output.

  • Press Enter to display one more line of output.

What I want at the end is to record all the output from the show command but my script is timing out at the first --More-- prompt. How can I make the script to send new line characters (i.e. spacebar) everytime it gets the --More-- prompt?

Thanks in advance,

Dan