From: Juan P. F. G. <jfe...@gm...> - 2009-01-28 05:15:18
|
Here's an example of using cu (the article is in spanish but includes a small script) http://www.fathersfate.com.mx/wordpress/2006/05/05/automatizando-con-expect-y-cu/ Good luck On Mon, Jan 26, 2009 at 11:15 AM, Patrick B. <c.p...@gm...> wrote: > > This is my first post in this forum. > > I am trying to automate the setup of a network device from scratch through a > serial connection using a combination of minicom and perl. I initially > tried using minicom's built-in runscript program to do the configuration, > but found that it didn't allow me to do some things I wanted to (like > opening config files and piping their contents to STDIN), so I changed > minicom's setup to use perl instead. > > Now my problem is how to use Expect.pm. Minicomm's documentation states > "Stdin and stdout are connected to the modem, stderr to the screen" > > I'm just trying to get the basics of interaction at this point. > So far I've got: > > ---------------- > use Expect; > > my $exp = new Expect; > $exp->raw_pty(1); > > print "\n"; > $exp->expect(3, "root]\#"); > $exp->send("ls"); > ---------------- > > When I add "$Expect::Exp_Internal = 1;" to see what's happening, I get the > following: > ---------------- > : Does `' > match: > pattern #1: -ex `root]#'? No. > > Waiting for new data (3 seconds)... > TIMEOUT > Returning from expect with TIMEOUT of EOF > ---------------- > > A standard "print" command works just fine. How do I hook expect.pm to > STDIN/STDOUT? > > Thanks, > Patrick > -- > View this message in context: http://www.nabble.com/Using-perl-and-Expect.pm-with-minicom-tp21670581p21670581.html > Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |