./bg1.jpg

'

./1.gif

Expect Commands

set

set a 15
set b "hello"

send & puts

send "Mozilla Firefox OS is written in\n"
send "HTML5\n"
puts "Mozilla Firefox OS is written in"
puts "HTML5"

./tip.png | puts automatically appends a new line.

expect

expect "pattern" action
expect {
 "pattern1" action1
 "pattern2" action2
 "pattern3" {
 action3a
 action3b
 }  }
Glob patterns (Shell-style)

expect -gl "super *"

Regular expressions

expect -re "(login|Username):"

Exact strings

expect -ex "* wars"

Other Handy Commands

spawn

spawn ./a.out
spawn chromium
spawn gnome-terminal

Interact

interact

Control Statemets

If Condition

if {$temperature < 50} {
puts "It’s pretty cold."
}

While

while {$temperature < 20} {
puts "Ice Age!"
}

'

./ref.png
./footer.png
./cc.png