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

Re: Suppressing failed glob patterns



* Frank Terbeck (Thu, 4 Dec 2008 22:04:41 +0100)> 
> Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>:
> > 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?!
> 
> Check these settings: <http://zshwiki.org/home/options/expn>
> 
> And also see what the difference between
> 
>   % echo non-existing-file.*
> and
>   % echo non-existing-file.*(N)
> 
> is.
> 
> That's documented in 'man zshexpn' and a list of available modifiers
> and flags is also in <http://www.bash2zsh.com/zsh_refcard/refcard.pdf>.

Yes, I know about that. And that's what I've been using until now. But 
it's also exactly what I not what. I don't what to give the command an 
empty pattern. Compare:

% rm non-existing-file.*
zsh: no matches found: non-existing-file.*

% rm non-existing-file.*(N)
rm: missing operand
Try `rm --help' for more information.

I just want rm not to be executed (like it's the default) but without 
the error (which is fine when I do it interactively but not in a 
script).

Thorsten



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