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: what do you expect from set prompt {$ } spawn ssh $user@$host expect "Password: " send $password\r expect $prompt send ls\r puts "The output is '$expect_out(buffer)'." ? You'll probably see something like the logon message. To achieve what people think they want, it's necessary to write instead spawn ssh $user@$host expect "Password: " send $password\r expect $prompt send ls\r expect $prompt puts "The output is '$expect_out(buffer)'." Do you see the difference? ---- It's sometimes useful to expect * ; # Receive *anything* returned immediately. and/or expect timeout ; # Receive everything returned up to $timeout seconds. when one "just wants the answer". Also, note that '''$expect_out(buffer)''' doesn't really hold what people want; it typically needs to be filtered down at least to eliminate the prompt.