No, because the
expect command doesn't have a return value -- or more precisely, always has an empty string return value -- and so you have an invalid boolean expression for your
while command.
What you're trying to do is actually fairly easy with the
exp_continue command. When used in the
body of one of your
expect actions when it matches a pattern, it causes the
expect command to "restart;" the [tt]timeout[/tt] timer is reset and the
expect command starts reading input and looking for matching patterns again. Thus, we can re-write your code as:
Code:
expect {
"mget *.txt" {
send -h "y\r"
exp_continue
}
}
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting,
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax