 |
 |
using expect
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Internet
Status:
Offline
|
|
Anyone have Expect running on their machine? Does anyone know how to use it?
I am totally lost
|

MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad 2
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status:
Offline
|
|
I got it to run although it took a while. I thought I'd end up using it a lot and have yet to actually write any scripts with it. Funny, eh?
For a tutorial go to the expect home page:
http://expect.nist.gov/
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Sep 2000
Location: Boston, MA
Status:
Offline
|
|
there is a good O'Reilly book for Expect
called 'Exploring Expect'. It may have
been written by D. Libes (author of Expect).
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Internet
Status:
Offline
|
|
Originally posted by hadocon:
Anyone have Expect running on their machine? Does anyone know how to use it?
I am totally lost
Thanx for the help, but I am abandoning my plans to use Expect. I am just going to automate ssh login by using non-interactive mode and an encrypted key...
|

MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad 2
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status:
Offline
|
|
I actually use expect all the time but not on my Mac. I administer 30 Linux machines and so I wrote scripts that ssh to each machine in turn, logs in and executes the commands that are arguments to the scripts. There seems to be very little useful material on the web about expect. Most of it is by expect's author and except for one basic tutorial, most of it is research papers full of theory and little practical information. He actually has a nice thing going; if you want to learn the details of expect, you have to buy his 600+ page book.
It is a really great program. It's pretty simple and straight forward for simple tasks. Let me describe a simple expect script. The script begins by invoking an interactive program. The rest consists of pairs of lines, a line starting with expect and the next starting with send. When the response from the interactive program matches the text following an expect line, the text following the corresponding send line is sent back to the interactive program. That's it.
A script can contain a lot more, including flow control stuff, but I couldn't find a good reference for that stuff without buying the book. Therefore I wrote shell scripts that write the expect script "on the fly" and pipe that into expect, "fooling it" into thinking that it was reading the script from a file. The shell script handles the logic and produces a "tailor made" simple expect script. I think it's a pretty cool arrangement.
All that said, if you're looking to just secure shell into a single machine, public key authentication really is a lot easier to set up and it works great. I've got it set up so that I type "ssh", a letter, <tab>, another letter, <tab> and I'm in!
|
|
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Internet
Status:
Offline
|
|
thanx 4 teh info. I have deceided to not use expect after all... I am now using netcat - much easier for what I want to do... :-)
|

MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad 2
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|