The doc says:
takes the same arguments as
expect, however it returns immediately.
But what does it mean by "returns immediately" ?
What's the usage of this command could be ?
Image you have spawned a program that, say, randomly asks "Are you sure [yn]?"
Imagine this program has 100 questions that need to be answered.
You don't want to have to conditionally expect an "Are you sure" question for each of those 100 questions.
Expect lets you do:
spawn /some/annoying/program
expect_before {
"Are you sure \[yn]?" {
send "y\r"
exp_continue
}
}
expect "first question"
send "first answer\r"
# and so on.
Now you are covered: expect implicitly adds the expect_before code into each expect command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With