zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Vasiliy Ivanov <beelzebubbie.logs@gmail.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: `=' expansion causes script/subshell to exit, bug?
Date: Thu, 27 Sep 2018 14:41:06 -0500	[thread overview]
Message-ID: <647E0B88-B2E9-4337-B3CA-439093B02C17@dana.is> (raw)
In-Reply-To: <16141d86-9d3e-275f-f7b4-d8b07fc97aa7@gmail.com>

On 27 Sep 2018, at 14:20, Vasiliy Ivanov <beelzebubbie.logs@gmail.com> 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


  reply	other threads:[~2018-09-27 19:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 19:20 Vasiliy Ivanov
2018-09-27 19:41 ` dana [this message]
2018-09-27 20:33   ` Bart Schaefer
2018-09-27 20:37     ` dana
2018-09-27 22:38 ` Mikael Magnusson

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=647E0B88-B2E9-4337-B3CA-439093B02C17@dana.is \
    --to=dana@dana.is \
    --cc=beelzebubbie.logs@gmail.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).