bug-findutils
[Top][All Lists]
Advanced

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

Re: [PATCH] find: doc: Fix -prune SCM example directories and make it mo


From: raf
Subject: Re: [PATCH] find: doc: Fix -prune SCM example directories and make it more efficient
Date: Sat, 19 Nov 2022 11:36:42 +1100

On Sat, Nov 19, 2022 at 09:48:27AM +1100, raf <raf@raf.org> wrote:

> Hi,
> 
> Here's the second attempt. I've made it clear that the only "fix"
> is to the example directories and output, not to the command itself.
> I've restored the three-exec version of the command in both find.1 and
> find.texi, so that the only improvement is the addition of "-type d"
> to prevent the three execs happening for every file as well. In
> find.texi (only), I've added the even more efficient single-exec
> version of the command, and I chose this version:
> 
>   -exec sh -c 'test -d "$1"/.svn || test -d "$1"/.git || test -d "$1"/CVS' . 
> {} \;
> 
> rather than this version:
> 
>   -exec sh -c '[ -d "$1"/.svn ] || [ -d "$1"/.git ] || [ -d "$1"/CVS ]' . {} 
> \;
> 
> But note that the first version is longer, and the line is 82 characters
> long. If that's no good, the second version might be preferable.
> But I did notice other lines in find.texi that were longer than 80 characters,
> so I assume it's OK.
> 
> cheers,
> raf

I've just remembered that the example in find.texi was actually incorrect.
It didn't have the parentheses around the execs that were in the find.1
version of the example. Without them, it's equivalent to:

  exec or exec or (exec and print and prune)

rather than the intended:

  (exec or exec or exec) and print and prune

I did put the missing parentheses in find.texi as well,
but forgot to mention it above.

cheers,
raf




reply via email to

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