From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4565 invoked from network); 26 Aug 1999 18:37:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Aug 1999 18:37:14 -0000 Received: (qmail 17437 invoked by alias); 26 Aug 1999 18:36:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7510 Received: (qmail 17428 invoked from network); 26 Aug 1999 18:36:57 -0000 From: "Bart Schaefer" Message-Id: <990826183637.ZM26298@candle.brasslantern.com> Date: Thu, 26 Aug 1999 18:36:37 +0000 In-Reply-To: <990826180618.ZM26162@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: /bin/zsh -ce 'false; echo bug'" (Aug 26, 6:06pm) References: <990826180618.ZM26162@candle.brasslantern.com> X-Mailer: Z-Mail Lite (5.0.0 30July97) To: "Owen M. Astley" , zsh-workers@sunsite.auc.dk Subject: PATCH: Re: /bin/zsh -ce 'false; echo bug' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 26, 6:06pm, Bart Schaefer wrote: > Subject: Re: /bin/zsh -ce 'false; echo bug' > On Aug 26, 9:26am, Owen M. Astley wrote: > > Subject: Re: /bin/zsh -ce 'false; echo bug' > > On Wed, 25 Aug 1999, Matt Watson wrote: > > > > > gnumake-3.74 wants to use "/bin/sh -ce " > > > > I 'think' that POSIX doesn't allow for options of this type, it should be > > written as -c -e . > > Zsh interprets everything after the -c as part of the command, so that will > attempt to run a command named "-e". Here's a patch against 3.0.6, which should also apply to 3.1.6, to make zsh's behavior consistent with bash's in this instance. If you really want to run a command named "-e" (or anything else starting with - or +), after this patch you need one of zsh -cb ... zsh -c -b ... zsh -c- ... zsh -c - ... zsh -c -- ... where "-b" is of course the csh-ism for "--". It previously was neither necessary nor possible to combine -b and -c in any order (whichever came first was the only one interpreted). I await word from the more extensively POSIXified readers on whether this patch should be officially included. Index: Src/init.c =================================================================== @@ -236,14 +236,9 @@ } if (**argv == 'c') { /* -c command */ - if (!*++argv) { - zerr("string expected after -c", NULL, 0); - exit(1); - } - cmd = *argv++; + cmd = *argv; opts[INTERACTIVE] &= 1; opts[SHINSTDIN] = 0; - goto doneoptions; } else if (**argv == 'o') { if (!*++*argv) argv++; @@ -276,6 +271,13 @@ } doneoptions: paramlist = newlinklist(); + if (cmd) { + if (!*argv) { + zerr("string expected after -%s", cmd, 0); + exit(1); + } + cmd = *argv++; + } if (*argv) { if (unset(SHINSTDIN)) { argzero = *argv;