1 |
578 |
markom |
This file is example/README. It contains brief descriptions of the
|
2 |
|
|
examples in this directory. Also listed are scripts from the Expect
|
3 |
|
|
archive at ftp.cme.nist.gov (See Expect's README for how to retrieve
|
4 |
|
|
these from). You are welcome to send me additional scripts. A number
|
5 |
|
|
of Expect scripts are also available in the Tcl archive, available via
|
6 |
|
|
anonymous ftp at harbor.ecn.purdue.edu
|
7 |
|
|
|
8 |
|
|
Note that on some systems, some of the scripts (notably kibitz and
|
9 |
|
|
dislocate) require that Expect be installed. (Merely compiling the
|
10 |
|
|
expect binary is not enough.)
|
11 |
|
|
|
12 |
|
|
--------------------
|
13 |
|
|
Expect scripts (See next section for example Tk scripts)
|
14 |
|
|
--------------------
|
15 |
|
|
Entries marked with "m" have their own man page.
|
16 |
|
|
Entries marked with "a" live in the Expect archive (see above).
|
17 |
|
|
|
18 |
|
|
archie - mails back response after talking to archie ftp-catalog.
|
19 |
|
|
m autoexpect - generate an Expect script from watching a session
|
20 |
|
|
autopasswd - runs passwd non-interactively for superuser.
|
21 |
|
|
a bc - Uses bc to do arbitrary precision math.
|
22 |
|
|
beer.exp - 99 Bottles of Beer On The Wall, Expect-style.
|
23 |
|
|
beer.exp.out - sample output from beer.exp (but you really have to
|
24 |
|
|
run it to see the timing aspect).
|
25 |
|
|
a bonfield.exp - solve Jim Bonfield's puzzle that won the 1991 Obfuscated
|
26 |
|
|
C Code contest.
|
27 |
|
|
carpal - warn about typing for too long without a break.
|
28 |
|
|
chess.exp - has two chess games play each other.
|
29 |
|
|
m cryptdir - encrypt all files in a directory.
|
30 |
|
|
m decryptdir - decrypt all files in a directory.
|
31 |
|
|
m dislocate - allow disconnection/reconnection to background processes.
|
32 |
|
|
dvorak - dvorak keyboard.
|
33 |
|
|
a eftp - ftp client with miscellaneous frills (also see rftp below).
|
34 |
|
|
expectd.proto - telnet daemon.
|
35 |
|
|
ftp-inband - does file transfer over telnet, rlogin, etc.
|
36 |
|
|
ftp-rfc - retrieve a DoD RFC from uunet via anonymous ftp.
|
37 |
|
|
ftp-talk-radio - gets "Internet Talk Radio" files from a host.
|
38 |
|
|
gethostbyaddr - translates internet address to name (with a higher
|
39 |
|
|
success rate than nslookup). Easier to use, too.
|
40 |
|
|
irsh - run interactive commands via rsh
|
41 |
|
|
m kibitz - lets two people control a program at the same time.
|
42 |
|
|
Lots of uses. I.e., You can help another person remotely.
|
43 |
|
|
Can run an editor and log a transcript of a conversation.
|
44 |
|
|
a libro-II - connect to Libro-II, the NIST library catalog.
|
45 |
|
|
lpunlock - unhangs a printer which says it is "waiting for lock".
|
46 |
|
|
a mirror_file - mirror a file from another ftp site, copying file only
|
47 |
|
|
if changed.
|
48 |
|
|
a mirror_dir - mirror a directory from another ftp site, copying only
|
49 |
|
|
files which have changed.
|
50 |
|
|
m mkpasswd - generates good passwords, optionally runs passwd with them.
|
51 |
|
|
a mx - return any MX records for the given host.
|
52 |
|
|
a noidle - run a shell which avoids being 'autologged out'.
|
53 |
|
|
a pager.alpha - sends a message to a (Alpha brand) pager.
|
54 |
|
|
a pager.mercury - sends a message to a (Mercury brand) pager.
|
55 |
|
|
m passmass - sets passwd on many machines simultaneously.
|
56 |
|
|
passwd.html - form to change a login passwd
|
57 |
|
|
passwd.cgi - CGI script to respond to passwd.html form
|
58 |
|
|
a ping-and-page - Ping list of hosts. If any down, page system admin.
|
59 |
|
|
read1char - read a single character for the shell, Perl, etc.
|
60 |
|
|
reprompt - like timed-read but reprompt after given amount of time.
|
61 |
|
|
rlogin-cwd - rlogin giving you same current working directory.
|
62 |
|
|
(Compare to telnet-cwd and xrlogin.)
|
63 |
|
|
robohunt - plays the game of hunt (from Berkeley).
|
64 |
|
|
It's more of a wild player than good, but amusing to watch.
|
65 |
|
|
Fun to throw against people who don't know about it.
|
66 |
|
|
rogue.exp - finds a good game of rogue.
|
67 |
|
|
rftp - recursive ftp (assumes UNIX-style ftpd at other end).
|
68 |
|
|
a s-key-rlogin - Automate rlogin (or telnet) using s/key
|
69 |
|
|
a scripttoggle - Like UNIX script command, but allow enabling/disabling
|
70 |
|
|
of recording.
|
71 |
|
|
a slip.shar - scripts to keep your SLIP link alive.
|
72 |
|
|
su.exp - start up an 'su' and run the argument.
|
73 |
|
|
telnet-cwd - telnet giving you same current working directory.
|
74 |
|
|
telnet-in-bg - put telnet (or any program) in bg, saving all remaining
|
75 |
|
|
output to a logfile.
|
76 |
|
|
a term-rlogin - run Term over rlogin. Good for traversing PPP/SLIP or
|
77 |
|
|
firewall rlogin connections.
|
78 |
|
|
a term-start - start up Term (a sophisticated UNIX-to-UNIX serial line
|
79 |
|
|
handler).
|
80 |
|
|
a timed-choice - offer user a timed choice of responses.
|
81 |
|
|
timed-read - a timed read for the shell, Perl, etc. Compare with
|
82 |
|
|
reprompt example.
|
83 |
|
|
m timed-run - run a program for only a given amount of time.
|
84 |
|
|
a try-phone-list - automate logging in to remote system, trying numbers
|
85 |
|
|
from a list until finding one that works.
|
86 |
|
|
m unbuffer - disables output buffering that normally occurs when
|
87 |
|
|
programs are redirected.
|
88 |
|
|
virterm - example of terminal emulation and expect operations on
|
89 |
|
|
character graphics using arrays (compare to term_expect
|
90 |
|
|
(below) which uses Tk widget).
|
91 |
|
|
vrfy - verifies an email address using SMTP/VRFY to remote site.
|
92 |
|
|
a waste-collection - Contact NIST service for hazardous waste pickup.
|
93 |
|
|
weather - retrieves weather forecasts.
|
94 |
|
|
m xkibitz - similar to kibitz but uses X Window System for handling
|
95 |
|
|
communication. Also, allows users to be added dynamically.
|
96 |
|
|
xrlogin - rlogin giving you same DISPLAY. (Compare to rlogin-cwd.)
|
97 |
|
|
|
98 |
|
|
To run, for example, chess.exp, type:
|
99 |
|
|
|
100 |
|
|
expect chess.exp
|
101 |
|
|
|
102 |
|
|
If expect is installed and your system supports the #! magic you can
|
103 |
|
|
invoke it as:
|
104 |
|
|
|
105 |
|
|
chess.exp
|
106 |
|
|
|
107 |
|
|
Each of these examples necessarily depends upon other binaries in the
|
108 |
|
|
system. For example, chess.exp depends upon the "usual" UNIX chess
|
109 |
|
|
program being present. If any of these programs are different,
|
110 |
|
|
it may cause the associated script to misbehave.
|
111 |
|
|
|
112 |
|
|
Please use the ".exp" extension on scripts that might otherwise have
|
113 |
|
|
names that could be confused with the real program, such as "rogue.exp".
|
114 |
|
|
Scripts that have unique names do not need the extension, such as "rftp".
|
115 |
|
|
|
116 |
|
|
--------------------
|
117 |
|
|
Sample Expectk scripts
|
118 |
|
|
--------------------
|
119 |
|
|
Entries marked with "m" have their own man page.
|
120 |
|
|
|
121 |
|
|
term_expect - template for doing expect operations on character
|
122 |
|
|
graphics.
|
123 |
|
|
m tknewsbiff - pops up a window (or plays sounds, etc) when news
|
124 |
|
|
arrives in selected newsgroups.
|
125 |
|
|
tkpasswd - Tk GUI for changing passwords.
|
126 |
|
|
tkterm - Tk terminal emulator in a Tk text widget.
|
127 |
|
|
xpstat - provide an X window front end to the xpilot game.
|
128 |
|
|
|
129 |
|
|
--------------------
|
130 |
|
|
Sample C and C++ programs that use the Expect library
|
131 |
|
|
--------------------
|
132 |
|
|
|
133 |
|
|
chesslib.c - same thing as chess.exp, but in C.
|
134 |
|
|
chesslib2.c - ditto, but uses popen and stream-style I/O.
|
135 |
|
|
chesslib++.c - ditto, but for C++.
|
136 |
|
|
m unbuffer.c - same as unbuffer example but standalone
|
137 |
|
|
|
138 |
|
|
You may change the value of CC or CPLUSPLUS in the Makefile, to
|
139 |
|
|
compile under gcc or other compilers. However, you may have to edit
|
140 |
|
|
the lines defining where the libraries are.
|
141 |
|
|
|