Re: Quick question about expect


thanks for the detailed response.
I am actually in the process of reading the books, but this was just
something that I was wanting to get done. I'll probabaly understand your
script more once I get deeper into the book, I don't have much backgrounud
with C and/or tcl, so the syntax is a little funky to me at this point. I
will go ahead and take your script and see what I can do with it.

As for the piano lesson, I guess I do owe you a couple now ;-)


"Uwe Klein" <uwe_klein_habertwedt@xxxxxxxxxxx> wrote in message
Babylon wrote:

The reason I want this to work, is because the plan is to use that
expect script, and wrap it with a shell script I have to connect to about
20 servers at the same time.... and I need them to be accessible via
screens... hope this makes sense..

Again, I really appreciate the help!

you don't want to use screen for that.

expect can give that functionality on its own.

read "man expect" read all, than look for "interact"
( expect is rather feature rich, and you should get an idea
what it can do )
read "the book" i.e. Exploring Expect by Don Libes
there is a chapter that talks about emulating screen (afair)

# do a spawn for every session you want.

set jobs {
root bongo blabla
root bingo blurp
nobody darkhole ""
set idx 0
foreach {user host passwd} $jobs {
set :A(($idx,user $user
set :A($idx,host) $host
spawn ssh ${user}@$host
set ::A($idx,spid) $spawn_id
# do the login stuff for each host
# done
lappend ::A(connections) $host
incr idx

# now talk to your sessions by
# expecting:
set currhost bingo
set curr [ lsearch $::A(connections) $currhost ]
# set curr 1

expect -i $::A($curr,spid) ....

exp_send -i $::A($curr,spid) ...

# or use interact with apropriate args.

do i get piano-lessons for free now ?



Relevant Pages

  • Re: internet proxy
    ... Is it possible to create separate shortcuts to IE - one with 'proxy server ... This script gets used when you enable the "Automatically ... connect to the host so no proxy would get used. ...
  • Re: How do I insert a cgi script into Publisher page?
    ... is not where I host my website. ... If your ISP supports cgi and has a form handling program then a form ... You must tell the server what e mail address you want the form results ... any where else you so desire or an auto redirect script with a delay. ...
  • Re: SAFE MODE,fopen, and chmod
    ... The files going into the users/ folder are created by the "apache" user. ... I have a free php hosting account with an account name 'sample'. ... The host is "running in SAFE MODE", where, it seems that for fopen, mkdir and many other functions, a check is done for the UID of the script-running process to be the same as the UID of each resource concernedand only if the UIDs match, is the function allowed to work successfully. ... The same script has in the prior lines created the directory ...
  • Re: Setting new date with offset in days
    ... run (or host) the script. ... WSH which can run both JScript and WScript. ... Isn't WScript the windows program ... It seems that JavaScript or JScript is best used in a web ...
  • Re: Scripting hosts backwards on my system
    ... the //H switch sets the default host which will be used when a script is ... Copyright Microsoft Corporation 1996-2001. ... even though CScript was long ago ...