有没有办法让 expect interpreter 说出类似的话
expect {
"keyword1" {send "action1"}
"keyword2" {send "action2"}
unpredicted stuff {send "action3"}
}
最佳答案
您可以在模式主体中使用 exp_continue
以在匹配后进行 expect 循环。您可以使用通用 .*
非上述类型的正则表达式来表示“意外的东西”,但您应该将其限制为行或词而不是 .*
其他关键字适用的粒度。
关于linux - 即使 "expect"不匹配任何东西,是否可以继续执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7737533/