Robert Hajime Lanning writes:
 > On 09/13/14 11:51, Doug Hughes wrote:
 > > FWIW: this is a perfect use case for xargs instead of exec. You'll save 
 > > a lot of fork/clone system calls and simplify your find. Brandon pointed 
 > > out the main problem, but consider this alternative:
 > > 
 > > find . -name '*.cs' -print -o -name '*.c' -print -o -name '*.h' -print | 
 > > xargs grep file-io.c
 > 
 > I have run into issues with "-print" and "xargs"... spaces in filenames...
 > Doesn't happen much when dealing with source code (.c .cs .h), but it happens
 > a lot when dealing with music and documents from Windows/Mac users.

Which is why you should use

find ... -print0 | xargs -0 ...

which cases'find to use '\0' instead of '\n' to terminate printed items,
and causes 'xargs' to parse its input correspondingly.
_______________________________________________
Tech mailing list
Tech@lists.lopsa.org
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to