Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] respect nullglob given multios
- X-seq: zsh-workers 44811
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] respect nullglob given multios
- Date: Thu, 10 Oct 2019 16:40:46 +0000
- Accept-language: en-GB, en-US
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191010164048euoutp01728feb16d6ecc0c069e93d522511e90c~MVqfDZ1Ga0052800528euoutp01G
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570725648; bh=JHd1igRxH2y+Cidg/4stkMt0p46e1anQ4o4vaMjSdQ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gIQ2WP9JSvkFfennyYPiO/ciGqrEstFqUXf/3wmhB4QZMta/EPNlI242GXAG0bQ51 kSQmtGv6tXhOnUCtCzVBhVLZTFR9kUlwg385oY0uHT/hf2otpiKvZ346rsCSuF+WZF OkaTlCjpafZnfGHoXjrmY7jF6P1mEWOFgwmZLAmY=
- In-reply-to: <eHuJUUFGjWrs2advn-wr-KY1I_DaHcKtYuWVNwErBRoooCtpjSfpKnHl7b-02chqYlfSOj-uJEHIBaNtFg0aabDfW8Lv46w-UFoQnQ1q-c0=@protonmail.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
- References: <CGME20191010011901epcas4p3219be0dd0e02bc7168787305e4e1dcf6@epcas4p3.samsung.com> <eHuJUUFGjWrs2advn-wr-KY1I_DaHcKtYuWVNwErBRoooCtpjSfpKnHl7b-02chqYlfSOj-uJEHIBaNtFg0aabDfW8Lv46w-UFoQnQ1q-c0=@protonmail.com>
- Thread-index: AQHVfwjca1vaQKKA/UK7Ml+5GZdce6dUBBgA
- Thread-topic: [PATCH] respect nullglob given multios
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author