Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > using expect

using expect
Thread Tools
Mac Elite
Join Date: Oct 2001
Location: Internet
Status: Offline
Reply With Quote
Jul 4, 2003, 11:05 AM
 
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
Reply With Quote
Jul 5, 2003, 01:42 PM
 
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
Reply With Quote
Jul 7, 2003, 07:48 AM
 
there is a good O'Reilly book for Expect
called 'Exploring Expect'. It may have
been written by D. Libes (author of Expect).
     
hadocon  (op)
Mac Elite
Join Date: Oct 2001
Location: Internet
Status: Offline
Reply With Quote
Jul 7, 2003, 09:12 AM
 
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
Reply With Quote
Jul 13, 2003, 12:39 AM
 
   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.
&nbsp;&nbsp;&nbsp;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.
     
hadocon  (op)
Mac Elite
Join Date: Oct 2001
Location: Internet
Status: Offline
Reply With Quote
Jul 13, 2003, 11:39 AM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:00 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2