getopts in functions

Andy Philpotts andy.philpotts@calendarcentral.com
Tue Oct 17 15:04: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?
My code looks like (... elides detail):
function jc()
{
 while getopts "d:c:h" OPT; do
 case $OPT in
 d ) ... ;;
 c ) ... ;;
 h ) echo $USAGE 
 return 1 ;;
 \? ) echo "Error, unrecognized option"
 echo $USAGE 
 return 1 ;;
 esac
 done
 ...
}
-- 
Best regards,
 Andy mailto:andy.philpotts@calendarcentral.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /