Email List: Xaustin-review-lX
[All Lists]

Defect in XCU find

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XCU find
From: Geoff Clare <yyy@xxxxxxxxxxxxx>
Date: Tue, 26 Sep 2006 12:35:15 +0100
@ page 457 line 17748 section find comment [gwc find example 8]

Problem:

There is no example showing the use of the find -exec ... {} + feature.
The following changes add one that also demonstrates the useful
technique of using "-exec sh -c ..." to provide more flexibility in
how the arguments substituted for {} can be used.

Action:

Add a new example:

8. The following command:

   find . ! -name . -prune -name '*.old' -exec \
      sh -c 'mv "$@" ../old' sh {} +

   performs the same task as:

   mv -- *.old .*.old ../old

   except that it avoids an "Argument list too long" error if there
   are a large number of files ending with ".old" (and avoids a
   ".*.old: No such file or directory" error if no files match .*.old).

   The alternatives:

   find . ! -name . -prune -name '*.old' -exec mv {} ../old \;

   and

   for file in *.old .*.old; do mv -- "$file" ../old; done

   are less efficient because they execute one mv command per file.

<Prev in Thread] Current Thread [Next in Thread>