2007-05-17, 20:45(-07), BN:
> Greetings
>
> SUN OS 5.10
>
> IF I dont give any arguements to optargs switch it will take the value
> I define
> if I pass an argument to switch, it should take that value:
[...]
You can't have options with optional arguments with getopts.
If -a was to take optional arguments, in
cmd -a -b
Is "-b" another option or an argument to -a.
At
http://stchaz.free.fr/ you'll find an implementation of
getopts that support optional arguments to options. In which
case, you have to write it:
cmd -aARG
cmd -a-b
cmd -a
(and there's no way to pass an empty argument).
or
cmd --long=arg
cmd --long
--
Stéphane