Eedoh
Eedoh

Reputation: 6278

Is it possible to continue execution even if "expect" does not match anything

Is there a way with expect interpreter to say something like

expect {
  "keyword1" {send "action1"}
  "keyword2" {send "action2"}
  unpredicted stuff {send "action3"}
}

Upvotes: 1

Views: 2509

Answers (1)

fche
fche

Reputation: 2790

You may use exp_continue in the pattern bodies to have expect loop after a match. You may use a general .* none-of-the-above type regexp for "unexpected stuff", though instead of .* you should limit it to the line or word granularity the other keywords apply to.

Upvotes: 1

Related Questions