Exploring Expect
A Tcl-based Toolkit for Automating Interactive Programs
Publisher: O'Reilly Media
Final Release Date: December 1994
Pages: 606

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.

Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews


by PowerReviews
oreillyExploring Expect

(based on 4 reviews)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 4 customers

Displaying reviews 1-4

Back to top

(5 of 5 customers found this review helpful)


Very useful, methodical book

By Scott

from North Ryde Sydney

About Me Developer, Sys Admin

Verified Reviewer


  • Accurate
  • Easy to understand
  • Helpful examples
  • Well-written


    Best Uses

    • Expert
    • Intermediate
    • Novice
    • Student

    Comments about oreilly Exploring Expect:

    I purchased this book way back in 1996 and have used it regularly ever since. I use it to automate Linux, Cisco router, and MikroTik router configuration. What prompted me to write this review now was I noticed it hadn't got much praise and I think it is one of the best of the O'Reilly books.

    What this tool does is allow you to automate tedious everyday tasks that involve logging on to other Unix machines or routers to carry out a series of commands. That sounds simple, but sophisticated things can be done such as controlling multiple processes at once, and using the output of one to feed into another. A great example of this is to make two chess processes play each other, as shown in the book.

    Small Expect scripts can also be used to enhance everyday Unix programs such as the ping program, also shown in the book.

    I love starting Expect scripts and watching them logon to 30 or 40 routers and do tedious stuff such as changing firewall rules, backing up files, changing bunches of passwords, etc.

    One particularly useful thing I get Expect to do is log on to a Cisco router, enable debugging, capture the output to a file, and then turn debugging off after a few seconds. If you've ever run debug on a Cisco router you'll know it can get quickly out of hand and lock up your router, and be hard to turn off. The script alleviates this issue.

    Because Expect is actually a TCL extension, you have all the power of that scripting language at your disposal. John Ousterhout's book TCL and the TK Toolkit is a great way to get started with TCL if you need help.

    Contrary to what one of the reviews said, I think this book is OK for a beginner. It would definitely help though to be familiar with TCL and regular expressions. That said, I think the book is itself a great tutorial on regular expressions.

    The book is very methodical and has many well explained examples. To me it is reminiscent of Richard Stevens' networkng and Unix books.

    Definitely take a look at this book. It is very interesting, it's written in an engaging style, and it could save you a *lot* of time. Oddly enough it doesn't even need a second edition, everything is still the same as far as Expect goes, even after 17 years. I have since upgraded to the ebook version though.

    (9 of 10 customers found this review helpful)


    Great Reference!

    By Russell Chapman

    from Undisclosed

    Comments about oreilly Exploring Expect:

    Written by the author of the program, this book is exactly what I expected, and more.

    If you enjoy automating tasks and writing scripts, Expect is a great addition to your toolbox, and this book is a great companion and welcome addition to your reference shelf.

    In performing many UNIX administration tasks, one which my current job allowed me the opportunity to automate is a means of maintaining passwords on many servers. In particular, we have a requirement to change root's password on some 1600+ servers monthly, as well as our own passwords on hundreds of servers. We have every flavor of UNIX and more variations of what to expect interacting with ssh, telnet, Sun, HP, Linux, AIX, NCR, and as many differences among the system prompts. After buying this book, I found much of my learning curve easier. The examples and the overview of Tcl are priceless.

    The Expect man pages are good, but having this book handy, with the program author's colorful and descriptive explanations has been a great help in the above and other successful tools using Expect.

    This may seem as much a rave of Expect as well as this book, but as a fan of both and a person who prefers a good reference manual, Exploring Expect earns my recommendation.

    (3 of 16 customers found this review helpful)


    not for beginners

    By tjotjobina

    from Undisclosed

    Comments about oreilly Exploring Expect:

    I have tried using this book to learn expect and are failed. Have given up learning expect since it seems there is no other book about expect. like a gentle introduction to expect. if u are a beginner dont bother with this

    (9 of 10 customers found this review helpful)


    Exploring Expect Review

    By Michael Chelomanov

    from Undisclosed

    Comments about oreilly Exploring Expect:

    I much appreciate the author's efforts in writing such a wonderfull program but speaking about the book... I found it to be a bit hard to follow. The systemization in introducing this technology leaves much to be desired.

    Most of the O'Reilly books you can literally can start reading and actually using them without of any prior experience in whatever the subject is, unfortunately it does not apply to the Exploring Expect book.

    For example right now I need to find out how to programm cursor movemets via expect in order to navigate menu driven telnet interface, and quess what - the only mentioning of the arrows is on page 286, which asks me to write code, which will do it. SO I an surfing the WWW for the answer. I would think that would be quite common question, but for some reason it is not answered in the book.

    Having said all above it is still a-must-to-have for any unix sysadmin it's O'Reilly book after all.

    Displaying reviews 1-4

    Back to top

    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Ebook:  $33.99
    Formats:  DAISY, ePub, Mobi, PDF
    Print & Ebook:  $43.99
    Print:  $39.99