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

Re: Suppressing "no matches found" Glob Message?

On Jun 27, 2004, at 6:42 AM, DervishD wrote:

Aaron Davies <agd12@xxxxxxxxxxxx> dixit:

Is there an easy way to temporarily turn off the "no matches found"
message that a failed glob returns? I'm looking mainly for something
simple enough to use in an alias--I have an alias called "lspf" which
is defined as "ls **/*(.)", but I'd like to make it return something
custom if no such files exist. Redirecting stderr doesn't help, because
(I assume) the message is generated by zsh, not ls.

Yes, change your pattern to, for example 'ls **/*(.N)'. The 'N'
means 'set option NULL_GLOB' for this pattern. This removes the

NULL_GLOB seems to remove the pattern entirely, so it no longer finds plain files only. I think what I want may be NOMATCH instead, but I can't figure out a code to set that. Is there one?
Aaron Davies

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