Version 1 of "expect_out(buffer) has the content of the previous send"

Updated 2006-12-16 17:15:46

The titular quote is something newcomers to Expect say very frequently. It indicates a misconception or two.

This explanation deserves its own Wiki page: Expect is organized in terms of a dialogue. It does not have a direct notion of "the content of the previous send"; instead, we all have the expectation that, after a command is sent, what appears before the next prompt is the result of that command. That's a convention, though. From Expect's perspective, it's all just characters going back and forth, with no privileged concept of "command", "prompt", or so on.

Let's do a simple example: