From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
Ray Andrews <rayandrews@eastlink.ca>,
Zsh Users <zsh-users@zsh.org>
Subject: Why does >&- produce an error message when connected to a builtin? (was Re: (N) defaults to whole directory listing)
Date: Fri, 18 Jun 2021 13:24:32 +0300 [thread overview]
Message-ID: <CAHLkEDv-n_zSmHt9GeL+L43k=r=kpUEi3g_8=rxCqmNQXDNgiA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7bN7miEudLZcLknDQH3im=u8CCe_3GUqtEJMtyidV8bUg@mail.gmail.com>
On Fri, Jan 29, 2021 at 9:05 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Fri, Jan 29, 2021 at 7:33 AM Roman Perepelitsa
> <roman.perepelitsa@gmail.com> wrote:
> >
> > ( ls -1 no_such_file(#q) ) 2>/dev/null
>
> That can be done without a subshell:
>
> { ls no_such_file(#q) } 2>&-
Why does >&- produce an error message when connected to a builtin,
rather than an external command?
% print -qqq
print: bad option: -q
% git -qqq
unknown option: -qqq
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
% print -qqq 2>&-
zsh: write error
% git -qqq 2>&-
%
And for the cases below, why does it produce an error message for the
former, but not for the latter?
% { print -qqq } 2>&-
zsh: write error
% { print no_such_file(#q); print -qqq } 2>&-
%
Is this an intended or unintended difference?
prev parent reply other threads:[~2021-06-18 10:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 15:24 (N) defaults to whole directory listing Ray Andrews
2021-01-29 15:33 ` Roman Perepelitsa
2021-01-29 17:01 ` Ray Andrews
2021-01-29 17:52 ` Lawrence Velázquez
2021-01-29 19:52 ` Ray Andrews
2021-01-29 18:47 ` Bart Schaefer
2021-01-29 19:04 ` Bart Schaefer
2021-01-30 10:50 ` Roman Perepelitsa
2021-01-30 15:00 ` Beverly Pope
2021-06-18 10:24 ` Marlon Richert [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='CAHLkEDv-n_zSmHt9GeL+L43k=r=kpUEi3g_8=rxCqmNQXDNgiA@mail.gmail.com' \
--to=marlon.richert@gmail.com \
--cc=rayandrews@eastlink.ca \
--cc=roman.perepelitsa@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/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).