Expect is known primarily as an indispensable application for system administrators. Amazingly enough, it is, at its heart, Just Another [Tcl] Extension (JATE). People use Expect to automate interaction with non-[GUI] (and typically non-cursor-controlled, even though a persevering Expect programmer can tackle them, too) applications that prompt the user for input. Examples of commands that often appear in Expect scripts are the [Unix] passwd, [ftp], [telnet], [ssh], [sudo], and command-line shells. Expect is the natural answer for those who want to automate password changes, periodically update FTP sites, manage Cisco routers, or check the statuses of a collection of remote systems by logging in. ---- **External Resources** http://expect.nist.gov/ was the original home Web site for Expect. It supplies sources and considerable history, background, and instruction. It does fail to mention, though, recognition [http://nvl.nist.gov/pub/nistpubs/sp958-lide/cntsp958.htm] of Expect as one of the 100 most important publications of [NIST]'s [http://www.nist.gov] first century. Note that the warning regarding expect 5.44 on that page is seriously out of date. The CVS 5.44 version linked to below is fine (and needed to build against Tcl 8.5). The current maintenance of the package can be found at http://expect.sf.net/ , with access to the CVS available via sf.net's cvs repository. Note that the link (on the sf.net primary page) for the CVS repository is out of date; visit http://sf.net/projects/expect/ and use the link there to look at the cvs repository from your web browser. This package is part of the [ActiveTcl] Batteries Included distribution on unix and as of 2005, the Windows version is available via ActiveTcl as well [http://blogs.activestate.com/activestate/2005/09/expect_for_wind.html]. [ActiveState] maintains online copies of documentation at [http://www.tcl.tk/man/expect5.31/index.html]. There's an expect FAQ here: http://expect.nist.gov/FAQ.html . There's a book called [BOOK Exploring Expect] to which most people refer when asked questions about Expect. [CL] keeps a bit of supplementary information on Expect at [http://phaseit.net/claird/comp.lang.tcl/expect.html]. [Expect External Resources] gives pointers to some wiki-external Expect material. ''[escargo] 11 Sep 2007'' - I found an '''expect-lite''' project on [SourceForge]: http://expect-lite.sourceforge.net/ [LV] 2007 Nov 09 [expect4j] [http://code.google.com/p/expect4j/] provides a certain level of expect's functionality to the [Jacl] / [Java] programmer. Package author Justin Ryan reports on the [TclJava] mailing list [http://sourceforge.net/mailarchive/forum.php?thread_name=67e5f3da0711080735k4820242ascc219f87c52ac45d%40mail.gmail.com&forum_name=tcljava-user] ''I've successfully ported a 100K tcl script based on expect to tcljava, without any changes, by just using expect4j.'' ---- **Wiki-Local Resources** * [Expect FAQ] * [Expect Hints and Tips] * [Expect Examples] * [Expect Tutorials] * [Debugging Expect programs] * [Remote input-output with Expect] * [Secure expect] * [Expect for languages other than Tcl] * [Most programmers don't know what Expect can do for them] * [I am new to Expect] * [Event-oriented Expect] * [Expect vs. Tcl] * [Network programming with Expect] * [Expect and Tclkit] * "[Expect and choice]" * "[It seems like Expect is not actively developed]" * [overlay] * Simplify the [handling of ANSI terminals using Expect] or [send special characters] * [Stubsification of Expect] * [An example wherein Expect controls a pager] * ["expect_out(buffer) has the content of the previous send"] * [Calc_Object] * [How Expect can capture the exit code from a remote command] * [Expect for Windows] * [Expect for languages other than Tcl] * [Checking your IMAP mail with Expect] * [How to access the result of a remote command in Expect] * "[Many people who think they need Expect do not need Expect]" * [Expect's frequently-made mistakes] * [How Expect sees function keys] * [How to send escape characters through Expect] * [Pipes vs Expect] * [expectk] * [expect in pure tcl] * [expect4j] * "[How do I get the result of a remote command when I have to pass through a third host?]" * "[Don't Expect to sleep]" ---- **Articles** 1. Don explains how far from trivial pty management is, and other lessons, in his memoir [http://expect.nist.gov/doc/seven-years.html] on Expect's first seven years. 1. "Expect Success" [http://www.samag.com/documents/s=7824/sam0310web1/sam0310web1.html] is, for [Kim Richert], "the best Expect article I've read". 1. "Expect--the only language you need" [http://www-106.ibm.com/developerworks/library/l-sc1/?n-l-4112] 1. "Expect: The Firefighter's Friend" [http://www.samag.com/documents/s=7237/sam0207a/0207a.htm] 1. "Unknown Expect" [http://www.samag.com/documents/s=9035/sam0402web1/] 1. "Test-driven development, Expect, and Systems Administration" [http://www.samag.com/documents/s=7824/sam0312web2/sam0312web2.htm] 1. http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/expect/tutorial.html 1. "Using Expect to Configure Cisco Routers" [http://www.samag.com/documents/s=1180/sam9903c/9903c.htm]: "... the entire task would take about a month for two people ... What used to take us a month now takes about an hour to finish completely and accurately." 1. "Expect plays a crucial role in network management" [http://www.ibm.com/developerworks/aix/library/au-expect/] ---- **Example Scripts** * [ftp-inband] ----- [LV] Note that '''expect''' is also a command that is a part of the expect extension; see http://www.tcl.tk/man/expect5.31/expect.1.html for the doc. [Lars H]: Also note that in the latter sense, [expect] is a powerful control structure (pretty much an [automaton], is it not?). ---- !!!!!! %| [Category Package] | [Category Expect] | [Category Command] | [Category System Administration] | [Category Control Structure] | [Category Unix] |% !!!!!!