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

Re: whence question

On Sat, 14 Jan 2017, Nikolay Aleksandrovich Pavlov (ZyX) wrote:

> (actually [nomatch] aborts execution: check difference between
> `xxx-nonexistent-command-xxx ; echo abc` and `echo
> xxx-nonexistent-file-xxx* ; echo abc`: first will show ?command not
> found? message *and* `abc`, second will just show an error).

This is in part relatively new behavior, see users/22338 (which I expected
to spawn some discussion but has gone unanswered).

> I have `NOMATCH` enabled also because I like Python ?explicit is better
> then implicit? principle: if I mean glob expansion I write glob
> expression and zsh either performs glob expansion or errors out.

CSH_NULL_GLOB is quite useful if you are using several globs and don't
know whether only some of them might match.  Generates the error only
if none of the globs match, silently removes the subset that don't if
some of them do.

On Sat, 14 Jan 2017, Daniel Shahaf wrote:

> Semantically, the glob «*.foo» and the literal filename «'*.foo'» would
> be different types, if the shell language were strongly typed.

That's stretching things a bit.  For that to be true, every command would
have to declare the types of its arguments.

In this particular case the shell does have "strong enough" data typing:
quoted strings vs. not-quoted strings.  The former are never wordlists
(unless a well-typed expansion inside them is a wordlist) and the latter
are always wordlists (which might result in only one word).

You just have to explicitly declare the type by providing the quotes.

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