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

Re: `=' expansion causes script/subshell to exit, bug?



On Thu, Sep 27, 2018 at 12:41 PM dana <dana@xxxxxxx> wrote:
>
>   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).

This is more fully described in the "Errors" section of the manual (see
http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Errors
"Certain errors are treated as fatal by the shell: in an interactive
shell, they cause control to return to the command line, and in a
non-interactive shell they cause the shell to be aborted.")

In particular it lists:
* File generation errors where not caught by the option BAD_PATTERN
* File generation failures where not caused by NO_MATCH or similar options

I'm a little puzzled by the "not" in that second one because this
clearly does cause an abort on a non-match.  Maybe it means "where not
caught by"?  Of course the first one is also sort of backward, it
should probably say "NO_BAD_PATTERN" or make reference to "unsetopt
BAD_PATTERN".

> You can disable it by setting either no_nomatch or null_glob

null_glob has no effect on this for me.  I think you must have
accidentally had both nonomatch and nullglob set.



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