delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT sources DOT redhat DOT com |
Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
Date: | Tue, 17 Oct 2000 18:03:27 -0400 |
From: | Andy Philpotts <andy DOT philpotts AT calendarcentral DOT com> |
X-Mailer: | The Bat! (v1.46c) |
Reply-To: | "andy.philpotts" <andy DOT philpotts AT calendarcentral DOT com> |
Organization: | Product Development |
X-Priority: | 3 (Normal) |
Message-ID: | <122102925068.20001017180327@calendarcentral.com> |
To: | cygwin AT sourceware DOT cygnus DOT com |
Subject: | getopts in functions |
Mime-Version: | 1.0 |
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 DOT philpotts AT calendarcentral DOT com -- 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 |