From: Hailey N. <Hai...@Su...> - 2003-10-02 20:13:10
|
Hi Chris, >>> First you will have to login to A. That involves what you have, plus >>> you will have to $exp->expect() for whatever telnet responds with when >>> it asks for the password. Then use a $exp->send() to send the password. >>> Then $exp->expect() for the prompt on A. Once you are logged into A, >>> use a $exp->send() to call telnet $B on A to login to B, $exp->expect() >>> for the password prompt, and then $exp->send() it. Once logged into B, >>> do the same to login to C, and the same for D, and the same for ... Still struggling with this. As soon as I logged into B from A I lose control of that session/connection. So $exp->send() won't do anything. Did you write something like this before. Can I have an example? Note: A know B but doesn't know C - in another words, to get to C you have to go through B. Thanks a million, Hailey >>>> >>>> Please show me how to do nested telnet sessions using Expect.pm module? >>>> >>>> 1- telnet to machine A >>>> 2- from A to mcahine B >>>> 3- from B to machine C >>>> >>>> ----- >>>> use Expect; >>>> >>>> my $exp = Expect->spawn("telnet $somehost") >>>> or die "Cannot spawn telnet: $!\n"; >>>> >>>> ... >>>> >>>> ----- >>>> Your help is greatly appreciated. Please reply directly to me since >>>> I am not on the alias. >>>> |