1 |
On Saturday 29 May 2010 14:59:16 Alan McKinnon wrote: |
2 |
> On Saturday 29 May 2010 17:05:34 Daniel D Jones wrote: |
3 |
... |
4 |
> > -exec (which potentially has problems with race conditions - -execdir |
5 |
> > should almost always be used instead) runs the command once for each file |
6 |
> > found. xargs will call the command once for as many files as it can fit |
7 |
> > on the command line. For some instances, like rm, that probably isn't |
8 |
> > significant. But if you're calling a complex process with lots of files, |
9 |
> > the overhead of starting the many extra processes may be significant. |
10 |
> |
11 |
> Perhaps you don't know Joerg yet. When dealing with the man, it's important |
12 |
> to know where he's coming from - and that is not "how Linux does stuff" |
13 |
> |
14 |
> He invariably refers to POSIX when mentioning standards. He uses this |
15 |
> standard to ensure that his code will work on any *nix platform. This puts |
16 |
> him at odds with the Linux crowd sometimes - two very different |
17 |
> viewpoints. |
18 |
|
19 |
I wasn't coming from a Linux perspective. I'm a network engineer. At work, I |
20 |
touch SSH servers running SunOS, file servers running BSD (don't recall what |
21 |
flavor off the top of my head - I'm not in them that often), terminals running |
22 |
HPUX and run Linux at home. xargs is available on all of them. |
23 |
|
24 |
> It's not "-exec" that causes one processto be launched per item found, it |
25 |
> is "-exec \;" |
26 |
> |
27 |
> He referred to "-exec +" which has the same behaviour as you mention - use |
28 |
> as many filenames as will fit on the command line. |
29 |
|
30 |
You're correct, of course. I missed that in the man pages. Mea culpa. (I'm |
31 |
a network engineer, not a sysadmin.) |
32 |
|
33 |
-- |
34 |
"If "everybody knows" such-and-such, then it ain't so, by at least ten |
35 |
thousand to one." - Robert A. Heinlein |