Re: Quick question about expect



Uwe,

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 ;-)


--
http://www.foreignkid.com
gmknews@xxxxxxxxx
A+, RHCE

"Uwe Klein" <uwe_klein_habertwedt@xxxxxxxxxxx> wrote in message
news:gqudf3-hbl.ln1@xxxxxxxxxxxxxxxxxxxxxxx
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 ?

uwe


.