perl - Passing Parameteres to Interactive script programatically -
we have interactive script(script 1) asks ip address , continues it's execution process. script 1 called script2. know ip address want pass ip automatically script manual intervention not required
i looked expect module. cannot install module in production server.
can suggest way overcome issue.
try this,
#script2.pl use strict; use warnings; use getopt::long; getoptions ( "ipaddress=s" => \$ip, ) or die("enter ip address"); $cmd = "perl script1.pl --ip=$ip"; system($cmd);
.
#script1.pl use strict; use warnings; use getopt::long; getoptions ( "ip=s" => \$ip, ) or die("enter ip address"); print "ip address $ip";
execute this.
perl script2.pl --ipaddress=10.11.12.13
if want execute script1 directly, can execute this,
perl script1.pl --ip=10.11.12.13
Comments
Post a Comment