From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4440 invoked from network); 7 Oct 2006 12:39:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Oct 2006 12:39:50 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 93479 invoked from network); 7 Oct 2006 12:39:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Oct 2006 12:39:43 -0000 Received: (qmail 4700 invoked by alias); 7 Oct 2006 12:39:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10809 Received: (qmail 4691 invoked from network); 7 Oct 2006 12:39:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Oct 2006 12:39:35 -0000 Received: (qmail 92403 invoked from network); 7 Oct 2006 12:39:35 -0000 Received: from vms044pub.verizon.net (206.46.252.44) by a.mx.sunsite.dk with SMTP; 7 Oct 2006 12:39:34 -0000 Received: from torch.brasslantern.com ([71.116.118.106]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J6R00KCYN5RZFQ3@vms044.mailsrvcs.net> for zsh-users@sunsite.dk; Sat, 07 Oct 2006 07:39:28 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k97CdQv2030316 for ; Sat, 07 Oct 2006 05:39:27 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k97CdQ6U030315 for zsh-users@sunsite.dk; Sat, 07 Oct 2006 05:39:26 -0700 Date: Sat, 07 Oct 2006 05:39:26 -0700 From: Bart Schaefer Subject: Re: Move command line options to start of line In-reply-to: <200610071202.k97C2BbC003441@pwslaptop.csr.com> To: zsh-users@sunsite.dk (Zsh users list) Message-id: <061007053926.ZM30314@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <200610071202.k97C2BbC003441@pwslaptop.csr.com> Comments: In reply to Peter Stephenson "Re: Move command line options to start of line" (Oct 7, 1:02pm) On Oct 7, 1:02pm, Peter Stephenson wrote: } } > zsh% ls -s file1 file2 -l } > } > the result of the command should be } > } > zsh% ls -s -l file1 file2 } > } > and not } > } > zsh% ls -l -s file1 file2 } } Why? Because I didn't give a complete example. Suppose instead that it's zsh% ls -s *1 *3 -l Then the result is supposed to be zsh% ls -s -l -- *1 *3 I.e., you must know where to insert the "--" because you don't know whether *1 is going to return something beginning with a "-", and if you know where to put the "--" you know what to put to its left. (Remember, I'm channeling Korn here, I don't necessarily *agree* that this is a good idea in the first place.) The counter-argument (Andrey's point) is that if the example is zsh% ls -s file1 *2 -l you don't know if file1 is an option-argument (to -s) or an operand, so without knowing the semantics of "ls -s" you can't know where to put the "--". I haven't bothered disputing Korn on this; I suspect the answer is that POSIX declares that option-arguments may appear in the same shell word as the option, so if you cared about POSIX in the first place and you meant "-s file1" to be a unit then you should already have been writing zsh% ls -sfile1 *2 and now there's no ambiguity of this type: } Consider (example contrived on the spur of the moment, but not wholly } unrealistic): } } su -c 'rm -f .zshrc' username -l But does su -c'rm -f .zshrc' username work in a true POSIX shell? Is it required to?