Mr S
Mr S

Reputation: 478

Expect and --More--

Im trying to use expect to auto accept an EULA that is prompted in --more--.

#!/usr/bin/expect
spawn "./greenplum-perfmon-web-4.1.2.0-build-2-RHEL5-x86_64.bin"
expect "--More--"
send "q"
expect "*****"
send "yes"
expect "*****"
send ""
expect "*****"
send "yes"

This does not work and Im not sure why. The script always halts at the --More-- prompt and the second I click ANYTHING it instantly processess the rest of the script.

I have tried with

expect -exact "--More--"

and

expect "the Customer"
(what is written above the --More--)

Upvotes: 1

Views: 1449

Answers (2)

martinhans
martinhans

Reputation: 1203

A solution avoiding expect altogether:

You could avoid the problem altogether by setting the PAGER environment variable to a different program and using the yes program. The following turns off yes and sends as many yes\n strings into the installer as it will take:

PAGER=cat  yes yes | ./greenplum-perfmon-web-4.1.2.0-build-2-RHEL5-x86_64.bin

If that looks weird to you, it is almost equivalent to the following:

export PAGER=cat
yes yes | ./greenplum-perfmon-web-4.1.2.0-build-2-RHEL5-x86_64.bin

The difference is that with the one-liner, PAGER is only set for that one command, not for anything that comes afterwards.

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798686

Try setting $MORE to something like -99999999 so that the more prompt never shows up.

Upvotes: 3

Related Questions