问题
I Have one problem when i am using expect. I need to list some information. But the program list 10 items and then shows (More...) and waits a key So:
expect "More..."
send "\n"
But the program shows more 10 lines and does it again, i can track how many times i need to do that, but the list changes a lot.
Is there a way to do something like:
while expect "More..." do
send "\n"
done
I know the expect waits for a string, is there some kind of "hit" command?
Thanks
回答1:
You want exp_continue
and the block form of expect
:
expect {
"More..." {
send "\n"
exp_continue
}
"something else to expect for"
}
来源:https://stackoverflow.com/questions/11797697/send-command-while-expect-can-get-specific-text