Re: Quick question about expect
- From: Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx>
- Date: Fri, 24 Mar 2006 20:44:48 +0100
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
.
- Follow-Ups:
- Re: Quick question about expect
- From: Babylon
- Re: Quick question about expect
- References:
- Quick question about expect
- From: Babylon
- Re: Quick question about expect
- From: Uwe Klein
- Re: Quick question about expect
- From: Babylon
- Re: Quick question about expect
- From: Bruce Hartweg
- Re: Quick question about expect
- From: Uwe Klein
- Re: Quick question about expect
- From: Babylon
- Re: Quick question about expect
- From: Uwe Klein
- Re: Quick question about expect
- From: Babylon
- Re: Quick question about expect
- From: Uwe Klein
- Re: Quick question about expect
- From: Babylon
- Quick question about expect
- Prev by Date: Re: Binary data INTO C extension?
- Next by Date: Re: Quick question about expect
- Previous by thread: Re: Quick question about expect
- Next by thread: Re: Quick question about expect
- Index(es):
Relevant Pages
|