Slide 1

Slide 1 text

The venerable “expect”

Slide 2

Slide 2 text

About: Bruno Sutic, github.com/bruno-/
 Rails & Javascript developer
 Ideal Project Group, Chicago

Slide 3

Slide 3 text

What is expect? • a classic Unix tool • enables automating *everything* in the terminal • written in 1990, Tcl

Slide 4

Slide 4 text

Can’t script everything • ssh password entry? • sudo password entry? • doing multiple ssh “hops”, usually password protected
 (enterprises, telecoms) • interactive command line applications (tmux) • (short demo)

Slide 5

Slide 5 text

Expect is… • surprisingly easy to learn • powerful • easily available (installed by default on OS X) • does not replace scripting, use it for small % of tasks

Slide 6

Slide 6 text

Demo
 automating ssh tasks

Slide 7

Slide 7 text

Commands summary • spawn - starts a program • expect - “listens” for output • send - “types” program input • interact - gives control to the user

Slide 8

Slide 8 text

Commands summary • log_user 0 - make the script quiet • puts - print to the screen • set timeout 10
 …
 timeout { exit 1 }

Slide 9

Slide 9 text

My real-world usage examples • Ericsson NT - automating SSH connections (3-4 hops) • Automated testing for tmux plugins • tmux plugin manager • tmux copycat

Slide 10

Slide 10 text

Questions?