From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13528 invoked from network); 2 Sep 2005 16:54:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Sep 2005 16:54:25 -0000 Received: (qmail 36302 invoked from network); 2 Sep 2005 16:54:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Sep 2005 16:54:18 -0000 Received: (qmail 21718 invoked by alias); 2 Sep 2005 16:54:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9369 Received: (qmail 21707 invoked from network); 2 Sep 2005 16:54:09 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Sep 2005 16:54:09 -0000 Received: (qmail 35159 invoked from network); 2 Sep 2005 16:54:09 -0000 Received: from vms044pub.verizon.net (206.46.252.44) by a.mx.sunsite.dk with SMTP; 2 Sep 2005 16:54:04 -0000 Received: from candle.brasslantern.com ([71.116.79.190]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTPA id <0IM700LVQ8A1D8P4@vms044.mailsrvcs.net> for zsh-users@sunsite.dk; Fri, 02 Sep 2005 11:54:02 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j82Gs148022638 for ; Fri, 02 Sep 2005 09:54:01 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j82Gs1ha022637 for zsh-users@sunsite.dk; Fri, 02 Sep 2005 09:54:01 -0700 Date: Fri, 02 Sep 2005 16:54:00 +0000 From: Bart Schaefer Subject: Re: How to handle unknown options in zparseopts In-reply-to: <20050902163515.GA962@DervishD> To: Zsh Users Message-id: <1050902165400.ZM22636@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20050831154454.GA122@DervishD> <1050902161402.ZM22534@candle.brasslantern.com> <20050902163515.GA962@DervishD> Comments: In reply to DervishD "Re: How to handle unknown options in zparseopts" (Sep 2, 6:35pm) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Sep 2, 6:35pm, DervishD wrote: } } > zparseopts -- a::=array } > (( $#array == 1 )) && { Actually I botched that. $#array will always be 1, because the argument (when present) is placed in the same array element as the option. The test should be [[ $array == -a ]]. } set -- -a xyz } zparseopts -A array -- a:: } } Does that mean that optional arguments must ALWAYS go in the same } word as the option? Yes, that's what I was trying to explain.