This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
getopts in functions
- To: cygwin at sourceware dot cygnus dot com
- Subject: getopts in functions
- From: Andy Philpotts <andy dot philpotts at calendarcentral dot com>
- Date: Tue, 17 Oct 2000 18:03:27 -0400
- Organization: Product Development
- Reply-To: "andy.philpotts" <andy dot philpotts at calendarcentral dot com>
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