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

Re: Suppressing failed glob patterns



On Thu, 4 Dec 2008, Thorsten Kampe wrote:

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


You want both of the things suggested in this thread ('-f' and '(N)'):

# original problem
$ rm non-existing-file.*
zsh: no matches found: non-existing-file.*

# '-f' doesn't solve 'no matches'
$ rm -f non-existing-file.*
zsh: no matches found: non-existing-file.*

# '(N)' doesn't solve the 'missing operand'
$ rm non-existing-file.*(N)
rm: missing operand
Try `rm --help' for more information.

# '(N)' solves one, '-f' solves the other
$ rm -f non-existing-file.*(N)
$


Best,
Ben



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