Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: NOMATCH errors



On Thu, 05 Jan 2017 22:35:21 -0500
Anthony Heading <anthony@xxxxxxxx> wrote:
> I was dusting off an old script which, admittedly inelegantly, did
>   PYTHON==python 2>/dev/null
> with NOMATCH set, which in the zsh 5 era seems to be a fatal error, i.e.
> a script

Well, it's an error if python isn't actually found, in which case you're
setting PYTHON to =python.  That's the sort of thing NOMATCH is designed
to trap.  So it's not clear to me, given you're being careful about
failed matches, why you'd want to allow it to set a duff value in this
case.

You have more clumsy options like

() {
  setopt localoptions nonnomatch
  PYTHON==python
}

The multiple "=" syntax is certainly a possibility, although I'm not
100% convinced nobody's using commands that begin with an "=", which
isn't actually forbidden.  Could alternatively be =~, since ~ needs
quoting anyway if you want to use it literally, so I think it's less
likely to break anything.

pws



Messages sorted by: Reverse Date, Date, Thread, Author