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

Re: "\rm -f" stops after the 1st glob not found



On Wed, 14 Aug 2013 06:25:27 -0300
Leonardo Barbosa <barbosa.leonardo@xxxxxxxxx> wrote:
> I'm sure that's a simple questions, but the keywords are so common
> that i couldn't find the answer by googling them.
> 
> My problem is this, when i type:
> 
> \rm -f *.aux *.blg *.out *.ps *.log *.toc *.tcp *.idx *.bak *.tps
> *.ilg *.ind *.sty *.bst *.bbl
> 
> zsh stops in the first glob it doesn't find. How could i fix this?

You need to change the options (using "setopt" in ~/.zshrc).  There are
various things you can do.

setopt NULL_GLOB

simply removes completely all command line entries where the pattern
didn't expand to anything.

setopt CSH_NULL_GLOB

does the same, but if all patterns failed to expand it's an error (a bit
safer).

setopt NO_NOMATCH

leaves the argument unmodified --- this is what some other shells do, so
it might be your best bet.  That means rm -f will try to remove files
called e.g. "*.bak", but the -f means that's OK.

There's a summary of all (well, some of) this in "From Bash to Z Shell"
chapter 9, page 211 (see www.bash2zsh.com for information about the
book).

pws



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