Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Suppressing failed glob patterns
- X-seq: zsh-users 13530
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: Suppressing failed glob patterns
- Date: Thu, 4 Dec 2008 21:39:04 +0000
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <alpine.LNX.2.00.0812041625440.3967@acer>
- Mail-followup-to: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <gh9g43$rt5$1@xxxxxxxxxxxxx> <20081204210441.GJ2692@xxxxxxxxxxxxxxx> <gh9hq5$ano$1@xxxxxxxxxxxxx> <alpine.LNX.2.00.0812041625440.3967@acer>
On Thu, Dec 04, 2008 at 04:30:58PM -0500, Benjamin R. Haskell wrote:
> 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)
> $
[...]
But
rm -f file1.*(N) file2.*(N)
would silently remove file1.xxx while there's no file2.* file
which the OP didn't want (he wanted rm not to be run if any one
pattern doesn't match any file).
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author