|
|
Index | Description | Usage | Options | Variables | Hints | Bulletproof
exp_continue [-continue_timer]
The command exp_continue
allows expect itself to continue executing rather than returning as it
normally would.
This is useful for avoiding
explicit loops or repeated expect statements.
The following example is
part of a fragment to automate rlogin. The exp_continue avoids having
to write a second expect statement (to look for the prompt again) if the
rlogin prompts for a password.
expect
{
Password: {
stty
-echo
send_user
“password (for $user):"
expect_user
-re “(.*)\n”
send_user
“\n”
send
“$expect_out(1,string)\r”
stty
echo
exp_continue
} incorrect {
send_user
“invalid password\n”
exit
} timeout
{
send_user
“connection timed out”
exit
} eof {
send_user
“connection failed:\
$expect_out(buffer)”
exit
} -re $prompt
}
For example, the following fragment
might help a user guide an interaction that is already totally automated.
In this case, the terminal is put into raw mode. If the user presses
“+”, a variable is incremented. If “p” is pressed, several returns
are sent to the process, perhaps to poke it in some way, and “i” lets the
user interact with the process, effec-tively stealing away control from
the script. In each case, the exp_continue allows the current
expect to continue pattern matching after executing the current action.
stty raw -echo
expect_after {
-i $user_spawn_id
“p” {send
“\r\r\r”; exp_continue}
“+” {incr
foo; exp_continue}
“i” {interact;
exp_continue}
“quit”
exit
}
By default, exp_continue
resets the timeout timer. The timer is not restarted, if exp_continue
is called with the -continue_timer flag.
This material is excerpted
from the O'Reilly book "Exploring Expect" by Don Libes and from the Solaris
manpage
|
|
|
|
 |

|
 |
|
Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
| |
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
| |
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
| |
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
| |
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!
|
|
Service Details
|
|
 |
|