[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find !(*.iso) -exec rm '{}' + fails when encounters filename beginni

From: Graham Lawrence
Subject: Re: find !(*.iso) -exec rm '{}' + fails when encounters filename beginning with -
Date: Tue, 22 Nov 2011 03:03:51 -0800

On Mon, Nov 21, 2011 at 12:15 PM, Bob Proulx <address@hidden> wrote:
> Your problem is
> related to a combination of the shell and find and not any of the
> coreutils programs.  Oh well.
My misunderstanding, thought find was part of coreutils

> Using !(*.iso) is a bash shell expansion.  It seems very inconsistent
> to me to use find for part and use shell for a different part.
My bad, I'm still not thinking in terms of what actually happens when
I run a command, still judging it by its apparent result
> The {} part is not special to the shell and does not need to be quoted.
> You can see what you are
> telling find by using echo to do so.
Another unappreciated gem, like find.  In the year I've been using
linux this use of echo never occurred to me.
> Once you understand that the shell is doing the expansion and not find
> then you will understand why neither of your cases are working as you
> previously expected.  With that understanding your expectations will
> be different and improved.  :-)
Its clearly high time to read the manuals and understand what a
command does in detail, instead of searching the web for an
off-the-peg answer to a problem, and then having no clue what to do
when it fails.
> I always test using either 'echo' or '-ls' first to make sure I am
> deleting what I should be deleting.
Thank you, Bob, for another excellent explanation, particularly for
the use of echo and ls to reveal what a command will do without having
to run it to find out.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]