Hi all,
I want to get options from command line by perl.
usage()
options:
-h Show this help message and exit
-t Name of tester [Required]
--timeout Set the timeout
-l Log and Report output dir
-r Alternative path to testcase scripts
-s Specify the suits of testcases to run
--testscripts Specify the testscripts to run
-p Specify the priority of the testcase to run
-a remoteaddress
-u remoteuser
--remotepasswd remotepassword
-o Upgrade Framework config file or not
I wrote a perl as followsmy
%options=();
getopts("ot:l:r:s: p:a:u:",\%options);
GetOptions("timeout=s"=> \$options{'timeout'},"testscripts=s@"=>\$options{'testscripts'},"remotepasswd=s"=>\$options{'remotepasswd'});
what's wrong with that?
when I run the script:
./aaa.pl -t Jack -l /logs/ -r /testscripts -s net -p 0 -a 10.22.11.22 -u damon -o
when I print all Options
it says
Option:
tester: imeout=400
timeout:
logdir: /logs/
sriptroot: emotepasswd=damon
suits: net
testscripts:
priority: 0
remoteaddress: 10.22.11.22
remoteuser: damon
remotepasswd:
what's wrong with that?
or can you give me a example using getopts and GetOptions?
Thanks
Damon