Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `=' expansion causes script/subshell to exit, bug?
- X-seq: zsh-workers 43575
- From: dana <dana@xxxxxxx>
- To: Vasiliy Ivanov <beelzebubbie.logs@xxxxxxxxx>
- Subject: Re: `=' expansion causes script/subshell to exit, bug?
- Date: Thu, 27 Sep 2018 14:41:06 -0500
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zbZEMP2GE+UzLn+0D/EBV87orlYo+cF7HaPzENqX+Ps=; b=xyxXSvm0GMMaAd49GZwvTv+YGySObebxg0yEfankVYN95c5ccsjNicjMOcX1rnnvXY wXyY2tMucKo4322JYLUBjPBdhVH90mdYZ0nkUS2w+AjNC+5EbbGY/bVao3EFzdv5SX3+ QXsKSjFqcVT3F5bBDsaHMcJrwS6Ta5fYLL9b/pDoKxJrQhlReI/RDI6hlJ5uW9F58ZE+ EgVa0a5uVob0AbWsNawdlgkhxgXVTv4HT8vJQsa52LaHu6hYHJmd/Ke674vcEfFo7DhP oCYEIKmGjUY6PpbjCyQzeCeHIH+QNoLYQS/t7CbnvGJfYlq9RJGBylZVt2BxY4YJGDRo KDvw==
- In-reply-to: <16141d86-9d3e-275f-f7b4-d8b07fc97aa7@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
- References: <16141d86-9d3e-275f-f7b4-d8b07fc97aa7@gmail.com>
On 27 Sep 2018, at 14:20, Vasiliy Ivanov <beelzebubbie.logs@xxxxxxxxx> wrote:
>% ( b=123123; print =$b; print 'ohshi' )
>zsh: 123123 not found
>
>Is it intended behaviour?
That's because of the option nomatch, which is enabled by default and is
documented as follows:
If a pattern for filename generation has no matches, print an error, instead
of leaving it unchanged in the argument list. This also applies to file
expansion of an initial ‘~’ or ‘=’.
The documentation could probably be more explicit — it doesn't just print an
error, it also aborts the current command (and apparently the following ones; i
didn't even realise that).
You can disable it by setting either no_nomatch or null_glob (which both pass
the = pattern through as a literal string, somewhat surprisingly). If you don't
want one of those on permanently (a lot of people would recommend against it for
safety reasons), you can wrap it in an anonymous function or similar:
() { setopt local_options no_nomatch; echo =123123 }
I don't think there's any way to disable it per-expansion in the vein of the (N)
glob qualifier.
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author