Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: BUG: Shell builtin `which` prints non-existent commands to stdout
- X-seq: zsh-workers 43537
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: BUG: Shell builtin `which` prints non-existent commands to stdout
- Date: Mon, 24 Sep 2018 23:18:20 +0100
- Cc: Zsh Workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1AKrLNMZdLx0z+icbyqR0DT/jNUNm1dZsDYoC0uEcfI=; b=ALBPMUPyoLZZqH1U0mH/Q19V31nBvMg20YDfFcHHsgQQD3GbcQKkxGNfHqh6vRADhl ddNulluiIGOrxjJhVZK0LbcfuJk3GJC+QGzSB0rG2iTW+oCv2i9pIaKrSdL/DXCqX42N ZB2u/rZMslwrWlhxuzN90cafBldHq6mp3i13B4dbIQ0EdT4AxLB42G9tti8KnuZQx8PQ ejO4yhcjB8Ftecek/jzBdWf4cX5Su5BQJeCkX3SRboA4fY5HD0XATHzDDhnogTnKqOh5 4SzovbOpVN96mFQ1iaEypRutsvyD/LHzkaUuXD27Ox0uGStChUeWA7+cClQxtLlhS2on 01dg==
- In-reply-to: <20180924125126eucas1p2e4ae5b63ce6320957ee99737f93181ae~XVwcoX7b91518615186eucas1p2T@eucas1p2.samsung.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>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Zsh Workers <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20180924080113epcas4p4f8f89aa03a2cebc5030fd45dca0f6e84@epcas4p4.samsung.com> <20180924080031.ee7lqmthxpmvqaal@klaus.seistrup.dk> <20180924102219eucas1p2469f827265423a2f3b5e7d98fc08412e~XTuQ1aIyy2293622936eucas1p2L@eucas1p2.samsung.com> <20180924122933.gpzp4vfix6zl66nw@klaus.seistrup.dk> <20180924125126eucas1p2e4ae5b63ce6320957ee99737f93181ae~XVwcoX7b91518615186eucas1p2T@eucas1p2.samsung.com>
2018-09-24 13:51:24 +0100, Peter Stephenson:
> On Mon, 24 Sep 2018 14:29:33 +0200
[...]
> + The original reason for this is that this behaviour is inherited
> + from the C shell (csh), where `tt(which)' itself orignated. So
> + it has been in zsh a very long time, and it is now a feature.
> + (It would be possible to change this in emulation modes; however.
> + so far this possibility has been seen has more of an additional
> + confusion than a help.)
[...]
csh had no "which" (tcsh has a which builtin), but there was a
"which" csh script added to 3BSD 1980 that was looking up
commands in $PATH and in the aliases defined through ~/.cshrc.
https://github.com/dspinellis/unix-history-repo/blob/BSD-3/usr/ucb/which
There's no easy way to write something to stderr in csh, so it's
not surprising that that script didn't.
In any case, the "command not found" can be seen as the normal
output of which, it is *the* information that it is returning
for that command.
zsh is not the only shell for which "type not-a-command" doesn't
output "command not found" on stderr. The Bourne shell, pdksh
and derivatives and ash-based shells do as well.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author