Exercises, examples and other material relating to training module T212. This topic is presented on public courses Learning to program in Tcl
, Tcl Programming
, Tcl Programming
Expect can be used to control multiple connections at the same time Ð a useful facility if it's connecting to processes that take a long elapsed time to run. In this module, you'll learn how to control multiple processes, never an easy task, but much easier with Expect than with other languages!
|Articles and tips on this subject||updated|
|4678||Expect with Ruby - a training example to get you started|
The Expect library, originally written for use wth Tcl, is also available in other languages and today I wrote an example to introduce how it's used in Ruby. Please note this is a spike solution - not going to fail (if it does) in a pretty way.
The principle of expect is that you spawn a process - ...
|3448||Checking all the systems on a subnet, using Expect and Tk|
There are times that we want to check the connectivity of all the systems on our subnet - to see which machines are present, and which are not. Pinging them one at a time is a bit slow, but pinging them all at once in a simple script sets up too many connections and the script is likely to fall over. ...
|2489||Parallel Pinging, using Python Threads or Expect spawn lists|
Ping is a very useful command to use within scripts for checking the presence (or absence) of a live system on our network, or indeed on the Internet. However, there are subtle differences in the format of its report on different operating system flavors, so any code that you write that needs to analyse ...
|2474||Using Tcl and Expect to automate repetitive jobs|
If you're typing the same series of instructions into your computer time and time again, perhaps with predictable variations depending on the responses that you get, you should consider using Expect. Expect adds three extra major commands to the Tcl language:
• spawn to start a process
• send ...
|1785||What is running on your network? (tcl and expect)|
Earlier this week, I gave a much-tailored Tcl course, with a strong helping of expect.
Expect adds three major extra commands to Tcl - spawn to start a new process under the control of the running Tcl/Tk code, send to send information to it and expect to await for - and decide on how to process - a ...
|1173||Cheat Sheet / Check list for Expect maintainers|
Programming in Expect can be very different (and more challenging) than conventional programming. Rather than write code (structured, if you like) through a series of events, you'll do better to start off with a co-operation diagram of the process that you want to automate [[For the newcomer, Expect ...
|287||Checking that all our servers are up and accessible|
We run a number of domains (around 50) on different servers (around half a dozen) in various locations in Englnd, Germany and the USA. How can I keep track of them all / do a quick test to chek that - at the least - they're all online to the Internet? And how can I do that test from anywhere I happen ...
Examples from our training material
|botget|| parallel expect example - get robots.txt from several servers|
|exp_ping|| expect - multiple parallel pings, Red Hat Linux version|
|livetest.exp|| Web based script - ping a series of remote hosts|
|mex|| multiple processes through expect|
|osx_tkpingle|| Checking which machines are online - Mac OSX |
|pingle|| parallel pings - Caldera Linux version |
|server.tce|| Expect script, web server, CGI|
|tkpingle|| Checking network continuity using ping, Expect and a Tk GUI|
PicturesExpect can handle multiple parallel processes
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
Spawn id s.
Expecting from multiple processes.
Adding Tk as well.
A few words of caution.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.