Expect a command with and without confirmation
- From: "Why Tea" <ytlim1@xxxxxxxxx>
- Date: 29 Mar 2007 05:14:57 -0700
How to Expect this with a generic proc to handle some commands that
require confirmation and some don't?
System prompt is ">"
Scenario 1 (no confirmation for the command)
cmd_no_confirm....
some outputs
Scenario 2 (confirmation required)
cmd_needs_confirmAre you sure?
Y....
some outputs
I tried this and it didn't work:
set $cmd "some command"
exp_send cmd\r
expect {
-re "Are you sure?\\r\\n> " { ## regexp didn't pick up this!!
exp_send Y\r ## is it OK to send here
exp_continue ## and back to the Expect loop?
}
> { # we are done }
timeout { # no good }
}
Thanks for any help and suggestion.
/Why Tea
.
- Follow-Ups:
- Re: Expect a command with and without confirmation
- From: Glenn Jackman
- Re: Expect a command with and without confirmation
- Prev by Date: Re: reusing "code entities" without oop
- Next by Date: Re: Expect-like tool for Windows GUI?
- Previous by thread: want to spread my code over different files
- Next by thread: Re: Expect a command with and without confirmation
- Index(es):
Relevant Pages
|