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. Expect works with remote applications, too.

Author:Kajizuru Gogis
Language:English (Spanish)
Published (Last):23 October 2008
PDF File Size:11.5 Mb
ePub File Size:14.66 Mb
Price:Free* [*Free Regsitration Required]

There were a couple of things that I am not really convinced about, but maybe it all depends on the context. All in all, I think it was well written and worth reading. I ran into Expect as the solution to a problem many years ago, probably in the mids, and I thought at the time that it seemed like a good idea to learn it more.

But I put it on the back burner until I happened to see this book in a used bookstores discount rack in Raleigh, North Carolina. I think it remains worth knowing, and is likely to be a useful part of a serious scripting toolbox. It is almost always easier to fix problems if you made some attempt at detecting them in the first place. These problems are much rarer now than when this book was written.

The age of the book—it was published in January , which means it was probably written over —means that many of the examples are outdated. They tend to involve telnet, login, rsh, ftp, and even finger. The examples provided for these, especially ftp and rsh, are unnecessary in modern sftp and ssh.

And of course programs change over time, so that while the script that attempts to re-run rogue until it generates a strength of 18 works, it never ends, because rogue no longer generates a strength of 18, or if it does, it is much less often than the one-in-twenty chance the author was expecting in This script is not provided in the book, it is merely described, because the script was part of the standard Expect installation.

The examples use, rather than example. While the publisher lists the release date as August on their ebook site, this appears to be simply the date the ebook was released—the snippets available and the page count match the print version exactly.

A few of the examples would still be useful for system administrators in special cases, such as scripting ping, but even ping now includes functionality that comes close to what the examples do.

One intriguing example involves bc, the command-line calculator. It was very difficult for me to write the Perl script padmath that I included in 42 Astounding Scripts to make bc accessible as a service on the Mac, because bc remains unsuitable for interaction with scripts. It looks like padmath would have been easier to write and more reliable in Expect.

Another interesting example is using Expect to make the command-line chess script play against itself. Expect can be used like putting two telephones together to connect different programs that each are expecting user input. A lot of the need for expect has gone. Command-line programs are a lot smarter now, and the options are greater. The web was only a few years old and is barely mentioned.

He mentions toward the beginning that some of the documentation for Expect is on the WWW, and he briefly mentions Mosaic toward the end. Even more interesting is that this functionality is augmented by the ability to act like a human, with a variable rate of typing.

What this means is that there are several code chunks in the book that you do not want to use. This really does make me want to find reasons to write Expect scripts.

It seems especially useful for its ability to mediate between the operator and the shell. One script I took from the book and have put into my toolbox is one that asks for user input, but with a timeout, so that the script can ask for input but not get locked up if there is no answer.

This seems like it ought to be useful.


Exploring Expect



Exploring expect


Related Articles