From: Ken I. <fn...@ua...> - 2008-12-11 05:29:43
|
On Wed, Dec 10, 2008 at 09:01:43PM -0800, Brandon Carroll 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 ... > 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? The system function ought to be able to do that, it just executes a shell command, and I think returns exit status. Or use backticks if you want to grab output from the process. You may need to specify the path to your executable expect script or to expect itself. If you have a full perl distribution help/man pages should be available, e.g., perldoc -f system Ken > > Thanks for any help anyone can offer! > Brandon Carroll > bra...@ma... > http://www.brandonjcarroll.com > http://www.globalconfig.net -- Ken Irving, fn...@ua..., 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks |