LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   xargs: unmatched single quote (https://www.linuxquestions.org/questions/linux-software-2/xargs-unmatched-single-quote-99830/)

fillatre 10-03-2003 10:49 AM

xargs: unmatched single quote
 
I am trying to do a replacment of the user and group nobody:nobody with apache:apache. chown is missing files, and xargs is giving me the following:

find / -user nobody -group nobody -print | xargs chown apache:apache

xargs: unmatched single quote


Any help is appreciated.

Thanks in Advance.

Guy

teval 10-03-2003 05:49 PM

Try running without the xargs and showing what find gives xargs.
Also try running without xargs. find has the ability to do the same thing with the -exec command

info find "Actions" "Run Commands" "Single File"

For more explenation of this really neat tool :)
Find does a lot more then just finding files.

chazmati 06-05-2004 10:04 PM

I know your question was a long while back, but I just Googled for "xargs: unmatched single quote" and this was the top result, so I figured I'd add my $.02 here.

I was getting the same error, and found that my find command was returning filenames with single quotes (for example, "./mp3s/Rock/Ben Folds - Rockin' the Suburbs.mp3 "). This caused the unmatched single quote error in xargs. You could probably filter your find command through sed before xargs, but it's easier to use find -exec as teval suggests:

$ find / -user nobody -group nobody -exec chown apache:apache "{}" \;

where the files found are substitued for the braces, and the quotes around the braces will handle the odd single quote in a filename. Note that you end the -exec command with a semicolon, but escape it with a backslash to prevent the shell from seeing it as a separator.


All times are GMT -5. The time now is 05:21 AM.