delorie.com/archives/browse.cgi | search |
> 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 AT po DOT CWRU DOT Edu http://cnswww.cns.cwru.edu/~chet/ -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |