From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Owen M. Astley" <oma1000@cam.ac.uk>, zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: /bin/zsh -ce 'false; echo bug'
Date: Thu, 26 Aug 1999 18:36:37 +0000 [thread overview]
Message-ID: <990826183637.ZM26298@candle.brasslantern.com> (raw)
In-Reply-To: <990826180618.ZM26162@candle.brasslantern.com>
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 <commandstring>"
> >
> > I 'think' that POSIX doesn't allow for options of this type, it should be
> > written as -c -e <commandstring>.
>
> 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;
prev parent reply other threads:[~1999-08-26 18:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-26 1:49 Matt Watson
1999-08-26 8:26 ` Owen M. Astley
1999-08-26 18:06 ` Bart Schaefer
1999-08-26 18:36 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=990826183637.ZM26298@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=oma1000@cam.ac.uk \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).