1 |
Le lundi 15 octobre 2007 à 23:43 +0100, Steve Long a écrit : |
2 |
> Roy Marples wrote: |
3 |
> The unintended globbing is indeed unsafe, in the general case. I'd do this: |
4 |
> |
5 |
> find "$D" -type f -name '*'"$v"'.*pm' -exec rm {} + |
6 |
> |
7 |
> The shell will still treat that all as one argument (this method is |
8 |
> typically used to insert variables into awk commands, or sed ones which |
9 |
> use ".) The + will make the command execution more efficient for commands |
10 |
> that take multiple filenames. The one caveat with + is that the {} must |
11 |
> appear at the end of the command.[3] |
12 |
|
13 |
I haven't reread the fine mans for a while but iirc, + could lead you to |
14 |
hit the argument buffer limit of your shell. xargs has --max-args to get |
15 |
around that and is also way faster than any -exec variant (at least |
16 |
that's what the bench I did on a PIV2.6Ghz showed me about 4 months ago) |
17 |
|
18 |
-- |
19 |
Gilles Dartiguelongue <eva@g.o> |
20 |
Gentoo |