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 43542
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Workers <zsh-workers@xxxxxxx>
- Subject: Re: BUG: Shell builtin `which` prints non-existent commands to stdout
- Date: Tue, 25 Sep 2018 10:10:22 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180925091025euoutp021166055fcee3ad13cf24685de05f43e6~XmYwx_BxS0167301673euoutp02H
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1537866625; bh=oaS8n+k1CLiVSbW77TgGN8Bd0eMxvTJ8K6TeCh0v3Fw=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Q2WQmm8MgmHe1KvWPwXrNpsMV67OPa0reWbC5m3XtXXFD76f4wfDvBBSthwvcKcFl c48cCmyEg4PDdDOlCe/5ReawJZ4hGtNtDn2zgaPthqENszq+zRiL9iOSYTvx7G/xSs LZbj5KzdhR44P/BJMah9fG9YDG2INhD7cwfypEiE=
- In-reply-to: <20180924223253.j46bxsughzy6grbf@chaz.gmail.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- 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> <20180924223253.j46bxsughzy6grbf@chaz.gmail.com>
On Mon, 24 Sep 2018 23:32:53 +0100
Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> About "other shells" above, AFAIK, tcsh is the only other shell
> that has a "which" builtin and it does also send "command not
> found" to stdout. So zsh behaves like every other shells in that
> regard.
Thanks, I've updated the text.
pws
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 9f634d1..81d7628 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -1976,21 +1976,22 @@ sect(Why does `which' output for missing commands go to stdout?)
as they would if the command was about to be executed but could not be
found.
- The original reason for this is that this behaviour is inherited
- from the C shell (csh), where `tt(which)' itself originated. 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.)
-
- If you want some further rationalisation, which may be what the C
- shell designers had in mind, you might note that `tt(which)' is
- designed as a way of outputting information about a command. So
- `this command can be found in ...' and `this command can't be found'
- are both bits of information here, unlike the case where the command
- is to be executed. So although it differs from other Bourne-style
- shells it is in fact self-consistent. Note that the exit status does
- reflect the fact the command can't be found.
+ The original reason for this is that this behaviour is inherited from
+ previous versions of `tt(which)', a builtin in tcsh (an adaptation of
+ the C Shell with better editing) and also a separate script. Other
+ shells had equivalent commands, `tt(whence)' and `tt(type), that zsh
+ has also adopted. So in fact this has always been a feature of
+ `tt(which)'. (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.)
+
+ If you want some further rationalisation, you might note that
+ `tt(which)' is designed as a way of outputting information about a
+ command. So `this command can be found in ...' and `this command
+ can't be found' are both bits of information here, unlike the case
+ where the command is to be executed. So although it differs from
+ other Bourne-style shells it is in fact self-consistent. Note that
+ the exit status does reflect the fact the command can't be found.
chapter(The mysteries of completion)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author