From: Brandon C. <bra...@me...> - 2008-12-11 16:05:48
|
You just made my day! @output = `/mypath/expect_script x.x.x.x`; worked like a champ! Thanks so much! Brandon Carroll bra...@ma... http://www.brandonjcarroll.com http://www.globalconfig.net On Dec 11, 2008, at 3:49 AM, Bradford Ritchie wrote: > What happens when you try > $status = system("/my/path/expect_script x.x.x.x"); > or > @output = `/mypath/expect_script x.x.x.x`; > > > > On Thu, Dec 11, 2008 at 12:01 AM, Brandon Carroll <bra...@me... > > wrote: > I have an expect script as follows: > > spawn telnet X.X.X.X $podport > set timeout 15 > sleep 2 > send $controlZ > send "\r" > > > expect { > "no]:" exit > > ")#" exit > > "#" {send "\r"} > ">" {send "enable\r"} > } > expect { > "Password:" {send "sanfran\r"} > "#" {send "\r"} > } > expect { > "Password:" {send "cisco\r"} > "#" {send "\r"} > } > expect { > "Password" {send "sanjose\r"} > "#" {send "\r"} > } > expect { > "% Bad passwords" exit > "#" {send "wr\r"} > } > expect { > "#" {send "write erase\r"} > } > expect "confirm" > send "\r" > expect "#" > send "reload \r" > expect "Proceed with reload?" > send "\r" > puts "reset of $podport complete\n\n" > exit > > The expect script does exactly what I want it to do, however I cant > seem to figure out how to call it from a perl script. So I think I > may need to re-write it in Expect.pl and if thats the case how do I > express the section: > expect { > "no]:" exit > > ")#" exit > > "#" {send "\r"} > ">" {send "enable\r"} > } > in the Expect.pl? Or, is there an easy way to just tell perl to run > the script? > > Thanks for any help anyone can offer! > Brandon Carroll > bra...@ma... > http://www.brandonjcarroll.com > http://www.globalconfig.net > > > > > > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, > Nevada. > The future of the web can't happen without you. Join us at MIX09 to > help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |