Blame README

Packit a69f91
NOTE: ALPHA AND BETA RELEASES OF TCL/TK ARE NOT SUPPORTED!
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Introduction
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
This is the README file for Expect, a program that performs programmed
Packit a69f91
dialogue with other interactive programs.  It is briefly described by
Packit a69f91
its man page, expect(1).  This directory contains the source and man
Packit a69f91
page for Expect.
Packit a69f91
Packit a69f91
This README file covers Expect 5.38 and up.  These versions of Expect
Packit a69f91
work with Tcl 8.2 and up and Tk 8.2 and up.  Significant changes and
Packit a69f91
other news can be found in the NEWS file.
Packit a69f91
Packit a69f91
The Expect home page is: http://expect.nist.gov
Packit a69f91
The Expect FAQ is:       http://expect.nist.gov/FAQ.html
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Getting Started - The Preferable Way
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
A book on Expect is available from O'Reilly with the title "Exploring
Packit a69f91
Expect: A Tcl-Based Toolkit for Automating Interactive Applications",
Packit a69f91
ISBN 1-56592-090-2.
Packit a69f91
Packit a69f91
The book is filled with detailed examples and explanations, and is a
Packit a69f91
comprehensive tutorial to Expect.  The book also includes a tutorial
Packit a69f91
on Tcl written specifically for Expect users (so you don't have to
Packit a69f91
read the Expect papers or the man pages).  Exploring Expect is 602
Packit a69f91
pages.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Getting Started - The Hacker Way
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
While the book is the best way to learn about Expect, it is not
Packit a69f91
absolutely necessary.  There are man pages after all and there are
Packit a69f91
numerous articles and papers on Expect.  All of my own papers are in
Packit a69f91
the public domain and can be received free.  If you are a hacker on a
Packit a69f91
tight budget, this may appeal to you.  Nonetheless, I think you will
Packit a69f91
find the book pays for itself very quickly.  It is much more readable
Packit a69f91
than the man pages, it includes well-written and explained examples,
Packit a69f91
and it describes everything in the papers as a coherent whole.  The
Packit a69f91
concepts in the papers actually only make up a small fraction of the
Packit a69f91
book.
Packit a69f91
Packit a69f91
The 1990 USENIX paper (see "Readings" below) is probably the best one
Packit a69f91
for understanding Expect conceptually.  The 1991 Computing Systems and
Packit a69f91
the LISA IV papers provide a nice mix of examples.  The only downside
Packit a69f91
is, the examples in these papers don't actually work anymore - some
Packit a69f91
aspects (e.g., syntax) of both Expect and Tcl have changed.  The
Packit a69f91
papers still make interesting reading - just don't study the examples
Packit a69f91
too closely!  Fortunately, most of the examples from the papers also
Packit a69f91
accompany this distribution - and all of these are up to date.
Packit a69f91
Packit a69f91
For all the details, read the man page.  It is long but you can get
Packit a69f91
started just by skimming the sections on the following commands:
Packit a69f91
Packit a69f91
	spawn		(starts a process)
Packit a69f91
	send		(sends to a process)
Packit a69f91
	expect		(waits for output from a process)
Packit a69f91
	interact	(lets you interact with a process)
Packit a69f91
Packit a69f91
To print out the Expect man page, invoke your local troff using the
Packit a69f91
-man macros, such as either of:
Packit a69f91
Packit a69f91
		ptroff -man expect.man
Packit a69f91
		ditroff -man expect.man
Packit a69f91
Packit a69f91
If Expect is installed, you can read the man pages using the "usual"
Packit a69f91
man commands, such as "man expect".  If not installed, view the man
Packit a69f91
page on your screen by saying something like:
Packit a69f91
Packit a69f91
		nroff -man expect.man | more
Packit a69f91
Packit a69f91
Expect uses Tcl as the underlying language for expressing things such
Packit a69f91
as procedures, loops, file I/O, and arithmetic expressions.  For many
Packit a69f91
simple scripts, it is not necessary to learn about Tcl.  Just by
Packit a69f91
studying the examples, you will learn enough Tcl to get by.  But if
Packit a69f91
you would like to learn more about Tcl or use it in your own
Packit a69f91
applications, read the Tcl README file which provides pointers to the
Packit a69f91
extensive Tcl documentation.  Or read Exploring Expect.  Chapter 2 of
Packit a69f91
Exploring Expect is a Tcl tutorial specifically designed for Expect
Packit a69f91
users.
Packit a69f91
Packit a69f91
An interactive debugger is bundled with Expect.  The debugger has its
Packit a69f91
own documentation that comes separately.  It is listed in the Readings
Packit a69f91
below.  Again, it is slightly out of date.  An up-to-date description
Packit a69f91
of the debugger appears in Chapter 18 of Exploring Expect.  This
Packit a69f91
chapter also contains additional advice and tips for debugging.
Packit a69f91
Packit a69f91
You may get the feeling that the Expect documentation is somewhat
Packit a69f91
scattered and disorganized.  This was true prior to publication of
Packit a69f91
Exploring Expect.  The book contains everything you need to know, all
Packit a69f91
up-to-date, and with examples of every concept.  (The book contains no
Packit a69f91
references to any of the Expect papers because none are necessary.)
Packit a69f91
Packit a69f91
----------------------
Packit a69f91
Examples
Packit a69f91
----------------------
Packit a69f91
Packit a69f91
This distribution contains many example scripts.  (All of the
Packit a69f91
substantive examples in the book are included.)  They can be found in
Packit a69f91
the example directory of this distribution.  The README file in that
Packit a69f91
directory briefly describes all of the example scripts.  Many of the
Packit a69f91
more sophisticated examples have man pages of their own.
Packit a69f91
Packit a69f91
Other interesting scripts are available separately in the directory
Packit a69f91
http://expect.nist.gov/scripts/ (ftpable as
Packit a69f91
ftp://ftp.nist.gov/mel/div826/subject/expect/scripts).  (See below for
Packit a69f91
how to retrieve these.)  You are welcome to send me scripts to add to
Packit a69f91
this directory.  A number of Expect scripts are also available in the
Packit a69f91
Tcl archive, available at ftp://ftp.neosoft.com/pub/tcl.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Readings on Expect
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
The implementation, philosophy, and design are discussed in "expect:
Packit a69f91
Curing Those Uncontrollable Fits of Interaction", Proceedings of the
Packit a69f91
Summer 1990 USENIX Conference, Anaheim, CA, June 11-15, 1990.
Packit a69f91
Packit a69f91
Examples and discussion, specifically aimed at system administrators,
Packit a69f91
are in "Using expect to Automate System Administration Tasks",
Packit a69f91
Proceedings of the 1990 USENIX Large Systems Administration Conference
Packit a69f91
(LISA) IV, Colorado Springs, CO, October 17-19, 1990.
Packit a69f91
Packit a69f91
A comprehensive paper of example scripts is "expect: Scripts for
Packit a69f91
Controlling Interactive Programs", Computing Systems, Vol. 4, No. 2,
Packit a69f91
University of California Press Journals, 1991.
Packit a69f91
Packit a69f91
Regression and conformance testing is discussed in "Regression Testing
Packit a69f91
and Conformance Testing Interactive Programs", Proceedings of the
Packit a69f91
Summer 1992 USENIX Conference, San Antonio, TX, June 8-12, 1992.
Packit a69f91
Packit a69f91
An explanation of some of the more interesting source code to an early
Packit a69f91
version of Expect is in Chapter 36 ("Expect") of "Obfuscated C and
Packit a69f91
Other Mysteries", John Wiley & Sons, ISBN 0-471-57805-3, January 1993.
Packit a69f91
Packit a69f91
A paper on connecting multiple interactive programs together using
Packit a69f91
Expect is "Kibitz - Connecting Multiple Interactive Programs
Packit a69f91
Together", Software - Practice & Experience, Vol. 23, No. 5, May 1993.
Packit a69f91
Packit a69f91
The debugger is discussed in "A Debugger for Tcl Applications",
Packit a69f91
Proceedings of the 1993 Tcl/Tk Workshop, Berkeley, CA, June 10-11,
Packit a69f91
1993.
Packit a69f91
Packit a69f91
Using Expect with Tk is described in the paper "X Wrappers for
Packit a69f91
Non-Graphic Interactive Programs", Proceedings of Xhibition '94, San
Packit a69f91
Jose, CA, June 20-24, 1994.
Packit a69f91
Packit a69f91
Simple techniques to allow secure handling of passwords in background
Packit a69f91
processes are covered in "Handling Passwords with Security and
Packit a69f91
Reliability in Background Processes", Proceedings of the 1994 USENIX
Packit a69f91
LISA VIII Conference, San Diego, CA, September 19-23, 1994.
Packit a69f91
Packit a69f91
More publications can be found in the Expect home page (see elsewhere).
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
How to Get the Latest Version of Expect or the Readings
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
Expect may be ftp'd as mel/div826/subject/expect/expect.tar.gz from
Packit a69f91
expect.nist.gov.  (Yes, the URL is much shorter:
Packit a69f91
http://expect.nist.gov/expect.tar.Z) Request email delivery by mailing
Packit a69f91
to "library@cme.nist.gov".  The contents of the message should be (no
Packit a69f91
subject line) "send pub/expect/expect.tar.Z".
Packit a69f91
Packit a69f91
Once you have retrieved the system, read the INSTALL file.  The papers
Packit a69f91
mentioned above can be retrieved separately (from the same directories
Packit a69f91
listed above) as:
Packit a69f91
Packit a69f91
 doc/seminal.ps.Z         (USENIX '90 - Intro and Implementation)
Packit a69f91
 doc/sysadm.ps.Z            (LISA '90 - System Administration)
Packit a69f91
 doc/scripts.ps.Z  (Comp. Systems '91 - Overview of Scripts)
Packit a69f91
 doc/regress.ps.Z         (USENIX '92 - Testing)
Packit a69f91
 doc/kibitz.ps.Z            (SP&E '93 - Automating Multiple
Packit a69f91
					Interactive Programs Simultaneously)
Packit a69f91
 doc/tcl-debug.ps.Z       (Tcl/Tk '93 - Tcl/Tk Debugger)
Packit a69f91
 doc/expectk.ps.Z      (Xhibition '94 - Using Expect with Tk)
Packit a69f91
 doc/bgpasswd.ps.Z          (LISA '94 - Passwds in Background Procs)
Packit a69f91
 doc/chargraph.ps.Z         (SP&E '96 - Testing and Automation
Packit a69f91
					of Character Graphic Applications)
Packit a69f91
Packit a69f91
The book "Exploring Expect" is described in more detail earlier in
Packit a69f91
this file.
Packit a69f91
Packit a69f91
The book "Obfuscated C and Other Mysteries" is not on-line but is
Packit a69f91
available in bookstores or directly from the publisher (Wiley).
Packit a69f91
Packit a69f91
Overhead transparencies I've used at conferences are also available in
Packit a69f91
the same way as the papers themselves.  The transparencies are sketchy
Packit a69f91
and not meant for personal education - however if you are familiar
Packit a69f91
with Expect and just want to give a short talk on it to your
Packit a69f91
colleagues, you may find the transparencies useful.  They vary in
Packit a69f91
length from 15 to 20 minutes in length.  These are:
Packit a69f91
Packit a69f91
  doc/seminal-talk.ps.Z    (USENIX '90 - Intro and Implementation)
Packit a69f91
  doc/sysadm-talk.ps.Z       (LISA '90 - System Administration)
Packit a69f91
  doc/regress-talk.ps.Z    (USENIX '92 - Testing)
Packit a69f91
  doc/tcl-debug-talk.ps.Z  (Tcl/Tk '93 - Tcl/Tk Debugger)
Packit a69f91
  doc/expectk-talk.ps.Z (Xhibition '94 - Expect + Tk = Expectk)
Packit a69f91
  doc/bgpasswd-talk.ps.Z     (LISA '94 - Passwords in the Background)
Packit a69f91
Packit a69f91
All of the documents are compressed PostScript files and should be
Packit a69f91
uncompressed and sent to a PostScript printer.  The documents are
Packit a69f91
intended for printing at 8.5"x11" and may fail on some ISO A4
Packit a69f91
printers.  According to Hans Mayer <Hans.Mayer@gmd.de>, you can make
Packit a69f91
them A4-able by searching for "FMVERSION" and changing the next line
Packit a69f91
from:
Packit a69f91
Packit a69f91
	1 1 0 0 612 792 0 1 13 FMDOCUMENT
Packit a69f91
to:
Packit a69f91
	1 1 0 0 594 841 0 1 13 FMDOCUMENT
Packit a69f91
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Using Expect with and without Tcl and/or Tk.
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
The usual way of using Expect is as a standalone program with Tcl as
Packit a69f91
the control language.  Since you may already have Tcl, it is available
Packit a69f91
separately.  Tcl may be retrieved as tcl.tar.Z in the same way as
Packit a69f91
described above for Expect.  When new releases of Tcl appear, I will
Packit a69f91
try to check them out for Expect as soon as possible.  If you would
Packit a69f91
like to get the newest Tcl release without waiting, ftp it from
Packit a69f91
ftp.scriptics.com (directory pub/tcl).
Packit a69f91
Packit a69f91
Expect may also be built using the Tk library, a Tcl interface to the
Packit a69f91
X Window System.  Tk is available in the same way as Tcl.
Packit a69f91
Packit a69f91
It is possible to embed the Expect/Tcl core and optionally Tk in your
Packit a69f91
own C programs.  This is described in libexpect(3).
Packit a69f91
Packit a69f91
Expect can also be used from a C or C++ program without Tcl.  This is
Packit a69f91
described in libexpect(3).  While I consider this library to be easy
Packit a69f91
to use, the standalone Expect program is much, much easier to use than
Packit a69f91
working with the C compiler and its usual edit, compile, debug cycle.
Packit a69f91
Unlike typical programming, most of the debugging isn't getting the C
Packit a69f91
compiler to accept your programs - rather, it is getting the dialogue
Packit a69f91
correct.  Also, translating scripts from Expect to C is usually not
Packit a69f91
necessary.  For example, the speed of interactive dialogues is
Packit a69f91
virtually never an issue.  So please try 'expect' first.  It is a more
Packit a69f91
appropriate tool than the library for most people.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Systems Supported
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
I do not know of any UNIX systems on which Expect will not run.
Packit a69f91
Systems which do not support select or poll can use Expect, but
Packit a69f91
without the ability to run multiple processes simultaneously.  I am
Packit a69f91
willing to work with you to complete a port.
Packit a69f91
Packit a69f91
Before sending me changes, please download or verify that you have the
Packit a69f91
latest version of Expect (see above).  Then send me a "diff -c" along
Packit a69f91
with a suitable English explanation.  If your diff involves something
Packit a69f91
specific to a machine, give me diffs for configure.in as well or give
Packit a69f91
me a hint about when the diffs should be done so I can write the
Packit a69f91
configure support myself.  Also please include the version of the OS
Packit a69f91
and whether it is beta, current, recent, or totally out-of-date and
Packit a69f91
unsupported.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Installing Expect
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
Expect comes with a configure script that provides for an automated
Packit a69f91
installation.  I believe you will find that Expect is very easy to
Packit a69f91
install.  (Tcl and Tk, too.)
Packit a69f91
Packit a69f91
For more information, read the INSTALL file.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Support from Don Libes or NIST
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
Although I can't promise anything in the way of support, I'd be
Packit a69f91
interested to hear about your experiences using it (good or bad).  I'm
Packit a69f91
also interested in hearing bug reports and suggestions for improvement
Packit a69f91
even though I can't promise to implement them.
Packit a69f91
Packit a69f91
If you send me a bug, fix, or question, include the version of Expect
Packit a69f91
(as reported by expect -d), version of Tcl, and name and version of
Packit a69f91
the OS that you are using.  Before sending mail, it may be helpful to
Packit a69f91
verify that your problem still exists in the latest version.  You can
Packit a69f91
check on the current release and whether it addresses your problems by
Packit a69f91
retrieving the latest HISTORY file (see "History" above).
Packit a69f91
Packit a69f91
Packit a69f91
Awards, love letters, and bug reports may be sent to:
Packit a69f91
Packit a69f91
Don Libes
Packit a69f91
National Institute of Standards and Technology
Packit a69f91
Bldg 220, Rm A-127
Packit a69f91
Gaithersburg, MD  20899
Packit a69f91
(301) 975-3535
Packit a69f91
libes@nist.gov
Packit a69f91
Packit a69f91
I hereby place this software in the public domain.  NIST and I would
Packit a69f91
appreciate credit if this program or parts of it are used.
Packit a69f91
Packit a69f91
Design and implementation of this program was funded primarily by
Packit a69f91
myself.  Funding contributors include the NIST Automated Manufacturing
Packit a69f91
Research Facility (funded by the Navy Manufacturing Technology
Packit a69f91
Program), the NIST Scientific and Technical Research Services, the
Packit a69f91
ARPA Persistent Object Bases project and the Computer-aided
Packit a69f91
Acquisition and the Logistic Support (CALS) program of the Office of
Packit a69f91
the Secretary of Defense.
Packit a69f91
Packit a69f91
Especially signicant contributions were made by John Ousterhout, Henry
Packit a69f91
Spencer, and Rob Savoye.  See the HISTORY file for others.
Packit a69f91
Packit a69f91
--------------------
Packit a69f91
Commercial Support, Classes
Packit a69f91
--------------------
Packit a69f91
Packit a69f91
Several companies provide commercial support for Expect.  If your
Packit a69f91
company has a financial investment in Expect or you wish to be assured
Packit a69f91
of continuing support for Expect, you can buy a support contract this
Packit a69f91
way.  These companies currently include:
Packit a69f91
Packit a69f91
ActiveState
Packit a69f91
#200 - 580 Granville St
Packit a69f91
Vancouver, BC
Packit a69f91
V6C 1W6 Canada
Packit a69f91
+1 (604) 484-6800
Packit a69f91
http://www.activestate.com/Company/contact.plex
Packit a69f91
Packit a69f91
Cygnus Support
Packit a69f91
1937 Landings Drive
Packit a69f91
Mountain View, CA  94043
Packit a69f91
+1 (415) 903-1400
Packit a69f91
info@cygnus.com
Packit a69f91
http://www.cygnus.com
Packit a69f91
Packit a69f91
Computerized Processes Unlimited (CPU)
Packit a69f91
4200 S. I-10 Service Rd., Suite 205
Packit a69f91
Metairie, LA  70006
Packit a69f91
+1 (504) 889-2784
Packit a69f91
info@cpu.com
Packit a69f91
http://www.cpu.com
Packit a69f91
http://www.cpu.com/cpu/expect.htm (Expect class page)
Packit a69f91
Packit a69f91
CPU provides Expect support and also Expect classes.  Contact them for
Packit a69f91
more information.
Packit a69f91
Packit a69f91
Neither NIST nor I have any financial relationship with these
Packit a69f91
companies.  Please contact me to be added to this list.