Expect scripting is great for writing tests that are basically "make sure that running this command causes these logs to be printed". Expect lets you skip past the irrelevant output and look for specific lines in the logs.

Is there a way to make sure we don't encounter a certain message?

For instance, a simple Expect script might look like:

spawn ./my_launcher.sh
expect "System booted."

Is there any way to make sure we don't get a certain string before the "System booted." line appears?

Imaginary syntax to convey my goal:

spawn ./my_launcher.sh
expect-not "license activation error"
expect "System booted."

1 Answer 1


You can expect multiple things:

expect { 
    "license activation error" { 
        ... mark that this happened ...
    "System booted" {
        ... check if the above error didn't happen and do something ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .