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

Re: Suppressing failed glob patterns




On Dec 4, 2008, at 4:13 PM, N.J. Mann wrote:

In message <gh9g43$rt5$1@xxxxxxxxxxxxx>,
	Thorsten Kampe (thorsten@xxxxxxxxxxxxxxxx) wrote:

I like the default in zsh for failed glob patterns (which errors when no
file matches the pattern).

For example:
% rm file1.* file2.*
zsh: no matches found: file1.*

zsh never executes rm (which is fine). Additionially I would like to get rid of the error message in a script. Unfortunately redirecting stderr does not work (because rm is never executed). Is there a way to keep the
default and to suppress the error?!

The answer is to use rm -f in your scripts.


Actually unless the no_nomatch option is set, rm -f non-existent-file* will still cause zsh to tell you there's no match. Although with no_nomatch set you will not need to redirect STDERR to suppress the error that rm would give you.

--Mike H



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