zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] respect nullglob given multios
Date: Thu, 10 Oct 2019 16:40:46 +0000	[thread overview]
Message-ID: <1570725646.5885.4.camel@samsung.com> (raw)
In-Reply-To: <eHuJUUFGjWrs2advn-wr-KY1I_DaHcKtYuWVNwErBRoooCtpjSfpKnHl7b-02chqYlfSOj-uJEHIBaNtFg0aabDfW8Lv46w-UFoQnQ1q-c0=@protonmail.com>

On Thu, 2019-10-10 at 01:18 +0000, Joe Rice wrote:
> This patch makes multios behave less surprisingly with nullglob.
>
> Currently, multios throws a file not found error when a nullglob is
> given. This patch inserts /dev/null into the redirection list when the
> glob returns empty with no errors.
>
> Is this a behavior that would interest anyone else? I find myself
> using the `cat /dev/null *(N.)` idiom quite a bit and I thought the
> behavior made sense for the null case in multios.

This does seem a logical effect, though it ought to be documented.

pws

diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index 13496d8d3..76bc23efe 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -277,7 +277,10 @@ all the specified inputs to its output in the order specified, provided
 the tt(MULTIOS) option is set.  It should be noted that each file is
 opened immediately, not at the point where it is about to be read:
 this behaviour differs from tt(cat), so if strictly standard behaviour
-is needed, tt(cat) should be used instead.
+is needed, tt(cat) should be used instead.  If the option tt(NULL_GLOB)
+is set and filename generation produces no files, redirection is
+instead performed from tt(/dev/null), so that there is a valid, but
+empty, input stream.
 
 Thus
 


  reply	other threads:[~2019-10-10 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20191010011901epcas4p3219be0dd0e02bc7168787305e4e1dcf6@epcas4p3.samsung.com>
2019-10-10  1:18 ` Joe Rice
2019-10-10 16:40   ` Peter Stephenson [this message]
2019-10-11  0:25     ` Philippe Troin
2019-10-11  6:46       ` Joe Rice
2019-10-11  8:33         ` Peter Stephenson

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=1570725646.5885.4.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@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).