From: sumncguy <sum...@ya...> - 2008-02-06 14:02:41
|
I did search the forum first, found the snippet described but it still doesnt work. Heres the execution on a Solaris box. ~> mssh 10.10.10.10 Attempting to connect ... 10.10.10.10 Switching to enable... somerouter#BAIL! % Unknown command or computer name, or unable to find computer address somerouter#exit Connection to 10.10.10.10 closed. Here is the code Im using for this particular function. # $process->interact([$in_handle],[$escape sequence]) # $exp->interact(\*STDIN, 'BAIL!'); $child->interact(\*STDIN, 'BAIL!'); $child->send("show clock\n"); $child->expect(10,"#"); I appreciate all the help !! Chris Ken Irving wrote: > > On Mon, Feb 04, 2008 at 07:21:25PM -0800, sumncguy wrote: >> >> After racking my brains for a few weeks, I found that >> >> Expects interact will hold and continue / return based on user input. Im >> now >> trying to accomplish that with the Perl Expect.pm module. It says ... >> # $process->interact([$in_handle],[$escape sequence]) >> >> $child->interact(); >> >> $child->interact(STDIN,'X'); >> $child->interact([STDIN],['X']); >> $child->interact( ,'X'); obviously not >> $child->interact('X'); here too .. >> >> also tried all the above with dub quotes. >> .... must be missing something. >> >> In expect >> >> interact "X" return >> >> Stops, give the user a router (for example) prompt back. When he/she hits >> X, >> the expect script continues. > > You didn't hit upon the necessary syntax for passing a filehandle, e.g.: > > $ grep BAIL src/perl/radio-server.pl > $exp->interact(\*STDIN, 'BAIL!'); > > The form \*STDIN is a reference to a typeglob, and is necessary to pass > the filehandle as an argument. > > Ken > > -- > Ken Irving, fn...@ua... > Water and Environmental Research Center > Institute of Northern Engineering > University of Alaska, Fairbanks > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > -- View this message in context: http://www.nabble.com/Holding-perl-expect-until-user-ready-..-tp15282716p15306656.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |