getopts in functions
Chet Ramey
chet@nike.ins.cwru.edu
Wed Oct 18 07:42:00 GMT 2000
> Should getopts work correctly in functions? I find if I try that if I
> get an error processing the options, then retry the function, it seems
> to get confused.
>
> Do I have to do something explicit to reset getopts?
Yes. The bash manual page says
The shell does not reset OPTIND automatically; it must be
manually reset between multiple calls to getopts within the
same shell invocation if a new set of parameters is to be used.
`Resetting OPTIND' means to assign it the value 1.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list