[TAG] Sending a keystroke to remote application

Breen Mullins bpm at idiom.com
Thu Jul 15 02:37:45 MSD 2004


On Wed, 2004-07-14 at 13:23, Ben Okopnik wrote:

> The easiest way to write an "expect" script is by letting "expect" do it
> for you. The very first script in my /usr/share/doc/expect/examples is
> "autoexpect"; when run by itself, it spawns a shell and records whatever
> is done until you exit that shell. Conversely, you could type
> 
> autoexpect ssh joe at machine.com
> 
> and it will run your SSH session, recording everything you type in and
> get back. I find that the result is very, very verbose (I've cut a
> 200-line script down to ~10 lines), but almost always useable.

Right. 

Where expect really shines is in automating repetitive tasks. I
sometimes need to configure a lot of VLANs on a network switch.
I usually just configure one using autoexpect, then wrap a loop 
around the center of the script. It's better than configuring 
1024 VLANs manually!

Breen
-- 
Breen Mullins
San Mateo, California






More information about the TAG mailing list