Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Expect is quickly becoming a part of every UNIX user's toolbox. It allows you to automate Telnet, FTP, passwd, rlogin, and hundreds of other applications that normally require human interaction. Using Expect to automate these applications will allow you to speed up tasks and, in many cases, solve new problems that you never would have even considered before. For example, you can use Expect to test interactive programs with no changes to their interfaces. Or wrap interactive programs with Motif-like front-ends to control applications by buttons, scrollbars, and other graphic elements with no recompilation of the original programs. You don't even need the source code! Expect works with remote applications, too. Use it to tie together Internet applications including Telnet, Archie, FTP, Gopher, and Mosaic. Don Libes is the creator of Expect as well as the author of this book. In Exploring Expect, he provides a comprehensive tutorial on all of Expect's features, allowing you to put it immediately to work on your problems. In a down-to-earth and humorous style, he provides numerous examples of challenging real-world applications and how they can be automated using Expect to save you time and money. Expect is the first of a new breed of programs based on Tcl, the Tool Command Language that is rocking the computer science community. This book provides an introduction to Tcl and describes how Expect applies Tcl's power to the new field of interaction automation. Whether your interest is in Expect or interaction automation or you simply want to learn about Tcl and see how it has been used in real software, you will find Exploring Expect a treasure trove of easy-to-understand and valuable information.

Subscriber Reviews

Average Rating: 4.5 out of 5 rating Based on 6 Ratings

"Excellent for TCL " - by Karen on 18-FEB-2011
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I'm only in chapter two and I've already picked up some very valuable knowledge.
Report as Inappropriate

"p. 183 - alternate code" - by Anonymous on 02-DEC-2010
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I am still working from this book, and do appreciate the coverage. What I have found is that no single reference work is able to help me accomplish what I need to do. Examples often don't work "as is".

At this point, I want to offer an alternate to the second code example on p. 183, which did not work for me as is - this is what worked for me:

while 1 {
    send_user "Enter an RFC number: "
    expect_user {
        -re "(\[0-9]+)\n"  {break}
        -re "(. *)\n"   {send_error "$expect_out(1,string) is garbage!\n"}
        timeout {
            send_error "Sorry, I can't wait any longer!\n"
             exit 1

Report as Inappropriate

Table of Contents



The publisher has provided additional content related to this title.


Visit the catalog page for Exploring Expect

  • Catalog Page

Visit the errata page for Exploring Expect

  • Errata

Download the supplemental electronic content for Exploring Expect

  • Supplemental Content