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

Re: something like set nonomatch



Stefan Janke <gonzo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

> hallo,
> 
> exist for the zsh (version 3.0) something like set nonomatch for the
> csh. I need this for doing things like:
> alias suber='rm *.toc *~ *.aux'
> 
> ciao and thanx stefan

I guess that you mean that you don't want an error message if a glob
pattern matches nothing.

There is an option CSH_NULL_GLOB (use setopt CSH_NULL_GLOB) that seems
to make zsh behave like csh.

>From man zshoptions:

          CSH_NULL_GLOB
               If  a  pattern  for  filename  generation  has  no
               matches,  delete  the  pattern  from  the argument
               list; do not report an error unless all  the  pat-
               terns  in  a  command  have no matches.  Overrides
               NULLGLOB.

There is also an option NULL_GLOB

          NULL_GLOB (-G)
               If  a  pattern  for  filename  generation  has  no
               matches, delete the pattern from the argument list
               instead  of   reporting   an   error.    Overrides
               NO_NOMATCH.

But there is also a way to set NULL_GLOB locally for just one glob
pattern.

	       alias suber='rm *.toc(N) *~(N) *.aux(N)'

Should do the trick.

-- 
David Kågedal     Lysator Academic Computer Society       davidk@xxxxxxxxxxxxxx
http://www.lysator.liu.se/~davidk/                              +46-13 17 65 89



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