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

Re: Preventing "no matches found:"



2005/7/22, Jos Backus <jos@xxxxxxxxxxx>:
> On Fri, Jul 22, 2005 at 03:24:31PM -0700, Tim McNerney wrote:
> >   rm ~/log/**/*.log(m+7)
> >
> > and would like to avoid the message:
> >
> >   no matches found: ~/log/**/*.log(m+7)
> 
> You could try this:
> 
> % setopt nullglob
> % echo ~/log/**/*.log(m+7) | xargs rm
> 
> --
> Jos Backus
> jos at catnook.com
> 

You can turn on noglob for a single pattern by adding a (N) flag.  So
you could just do:

rm ~/log/**/*.log(m+7,N)

But that doesn't really solve your problem, because if rm has no
arguments, it'll complain.  Now, my personal advice would be to not
care, but if you do care, you could do this:
deadlogs=(~/log/**/*.log(m+7,N))
((#deadlogs)) && rm $deadlogs



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