From: Tim McNerney <yargo@mac.com>
To: zsh-users@sunsite.dk
Subject: Re: Preventing "no matches found:"
Date: Fri, 22 Jul 2005 23:47:37 -0700 [thread overview]
Message-ID: <0F3D354D-80ED-4455-81EF-33EB3C2BD5C8@mac.com> (raw)
In-Reply-To: <20050723021053.GA4125@lizzy.catnook.local>
Thanks to both. I was looking for the ,N, as I've come up with a few
methods to "silence" it otherwise, but I felt there was likely a more
elegant manner.
--Tim
On Jul 22, 2005, at 7:10 PM, Jos Backus wrote:
> On Fri, Jul 22, 2005 at 05:14:49PM -0700, John Reese wrote:
>
>> 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)
>>
>
> I knew there was a flag like that but I couldn't find it offhand.
>
>
>> 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
>>
>
> I used xargs so rm would never be called without arguments,
> avoiding this
> problem. But your solution is a little more flexible, e.g. you
> could emit a
> message depending on whether any files will be/were removed:
>
> deadlogs=(~/log/**/*.log(m+7,N))
> if (( $#deadlogs == 0 ))
> then
> echo "No longs removed."
> else
> rm $deadlogs
> echo "$#deadlogs logs removed."
> fi
>
> --
> Jos Backus
> jos at catnook.com
>
prev parent reply other threads:[~2005-07-23 6:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-22 22:24 Tim McNerney
2005-07-22 23:01 ` Jos Backus
2005-07-23 0:14 ` John Reese
2005-07-23 2:10 ` Jos Backus
2005-07-23 6:47 ` Tim McNerney [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0F3D354D-80ED-4455-81EF-33EB3C2BD5C8@mac.com \
--to=yargo@mac.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).