x
Loading
 Loading
Hello, Guest | Login | Register

How To Expect

In last month’s column, I used a small Expect script to communicate with a highly accurate clock that was attached to my system’s serial port. In this month’s column, we will take a more extended look at this very useful tool.

In last month’s column, I used a small Expect script to communicate with a highly accurate clock that was attached to my system’s serial port. In this month’s column, we will take a more extended look at this very useful tool.

Expect is a freely available software facility/programming language that allows you to automate pretty much any interactive task. Don Libes, who began writing Expect in 1990, puts it more tersely: “Expect [is a] software suite for automating interactive tools.” It allows a system administrator to create scripts that provide input to commands and programs that would otherwise “expect” — or demand — their input from the “terminal” (traditionally /dev/tty). Such input would otherwise need to be supplied by a human user or system administrator. Expect can send the proper input at the appropriate time to such programs without any user intervention; it can even make decisions about how to respond to successive prompts based upon the previous responses and/or whatever other factors and logic you have chosen to supply to the script.

Expect is an understated package. When I first heard about it, I thought that it might be somewhat useful in certain circumstances. However, as time has gone on, I have continued to find Expect ever more useful and have grown to depend on it as an essential item in my administrative tool suite.

Expect is built on top of the Tcl programming language, which makes having Tcl installed on your system a prerequisite for…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace