bug-findutils
[Top][All Lists]
Advanced

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

Re: xargs feature request...


From: Linda A. W.
Subject: Re: xargs feature request...
Date: Sat, 16 Apr 2005 19:05:42 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)



James Youngman wrote:
The program run by xargs is invoked directly with execvp(), and so the
arguments are not processed by the shell at all.  This means that
spaces and other special characters in the file names (if they are
file names) are not treated specially at all.  For this reason it
shouldn't be neccessary to use quotes.

The only time things don't work out quite this way is when the program
you are invoking is itself a shell script.
---
I think this has been the case a few times. As for worrying about quotes within my filenames, yes, it could be a concern, but quotes in file
names are less likely than spaces in my usage.


  In this situation the
arguments will be correctly passed to the shell script but the script
may not be processing such arguments directly.  Within the script,
spaces within the filenames are protected by correct quoting, for
example "$@".
---
        Would that put double quotes around the entire argument list rather 
than each item?


The xargs program also, by default, separates its arguments with
spaces.  When it is operating in this mode, it does interpret quotes
as I think you are hoping.  However, if you need to process arguments
which contain spaces and newlines, it is best to use xargs' "-0"
option, which corresponds to find's "-print0" action.
---
        Should the -0 option ... yeah, I guess it should thinking about
how they are passed....I'll give that a try to see if it clears up some of
my space/quote clutter...

Cheers!
Linda





reply via email to

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