Prob with GetOptions
am 16.02.2007 07:06:37 von aakashHello All,
I am writing a script wherein its usage is as follows :
mkelem [-h] [-dir [-rec]]
Now for this i have used the GetOptions module as follows :
$st = GetOptions("h|help" => \$help,
"dir=s" => \$dir,
"rec" => \$rec);
The script when executed with-dir option followed by an argument should go
to one part of the script as in :
mkelem -dir a b c
And the script executed with option -dir and -rec should do some other part
as in (which doesnt happen):
mkelem -dir -rec a b c
As i am using getopts module with "-dir=s", it is taking the -rec as its
argument and it doesnt consider it as an option (which i think is natural
with "dir=s") .
Also i do not want to use -rec option alone i.e. it is to be used either
with -dir option or not used at all.
Is this possible ???
Regards
Aakash