Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [patch] "which"-builtin writes diagnostics to stdout
- X-seq: zsh-workers 36357
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: [patch] "which"-builtin writes diagnostics to stdout
- Date: Tue, 1 Sep 2015 08:12:02 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>, Timo Buhrmester <fstd.lkml@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YIC+eIwY4gTuc2Yrlh/oliInv1OmnoCdUf8ywdjkorM=; b=YxUMUh06PF+ePDFNZ/NEPV25NdRF7iFZienEaQ6rfqS70cOTTkjLdqJ3qGP6F+MuCv XeDOF4I5IMAGn9TUK/GzcbFdwcYZux1arcih59X/pBsE1JORL0U25bzPFGKBMhyC8Biv K644SpYjxUEgJocKE+KIjx3SOzbmvETQLWnnwUoyS04mJGU6B5p4ETD4jg7sGJRaa3mG areQtxQQbsTdmnHJYOCCPv2Vy3af3gP8anP9InIXuGOG/2a6ejEdbTRMmv+5n5is2pQN L40iLYSCG3TvDJv2yMsUu9CeE3lw/rufShYGSl6li9/tZWrmRznfHY6blk7NXtn3IhW+ lHZQ==
- In-reply-to: <150831230431.ZM894@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150830030614.GB18893@frozen.localdomain> <CAH+w=7aNzRtsJcvGcfyYFPAiRtNY69imSN+oGrF7K7unD5aNcA@mail.gmail.com> <20150830052603.GE18893@frozen.localdomain> <150831230431.ZM894@torch.brasslantern.com>
On Tue, Sep 1, 2015 at 8:04 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Aug 30, 7:26am, Timo Buhrmester wrote:
> } Subject: Re: [patch] "which"-builtin writes diagnostics to stdout
> }
> } > > | % which doesnotexist
> } > > | doesnotexist not found
> } > >
> } > > the "doesnotexist not found" message goes to standard output,
> } > > rather than standard error.
> }
> } Out of curiosity, what reason would zsh (being more bourne-ish than
> } csh-ish, as far as I can tell) have to maintain this particular csh
> } glitch rather than fixing it?
>
> What makes you think it's a glitch?
>
> I.e., "not found" here is not an error message! It is the answer to the
> question you asked, and you asked for the answer in csh format ("which"
> is "whence -c"). If you don't want csh behavior, you should be using
> "whence" directly so that you can omit the "-c" option.
I guess the problem here is that in other shells, whence does not
exist, and which prints 'not found' to stderr. Zsh's which acts like
the csh variant even in the sh emulation, so finding the absolute path
of a command portably is pretty difficult. (In bash, both type and
which print 'not found' on stderr. In dash, which prints to stderr and
type prints to stdout. In zsh both print to stdout. type additionally
prints the extra 'foo is' first so it's less useful).
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author