xargs (was: Too many words from `` (csh))

Alex Martelli alex at am.sublink.org
Thu Mar 7 07:50:34 AEST 1991


mikel at teda.UUCP (Mikel Lechner) writes:

:ken at csis.dit.csiro.au (Ken Yap) writes:
	...
:>[tucana 462] chmod 644 `find . -type f -print`
:>Too many words from ``.
	...
:A better way to do what you want, (ie one that works), is this command:
:	find . -type f -exec chmod 644 {} ';'
:
:However, this will run a bit slower, since it will create a new chmod
:process for each file encountered.  But, it will work.

Right; an even better one is "find . -type f -print | xargs chmod 644".
If you don't have xargs, I'm sure you can find freely redistributable
implementations without difficulty.  One defect with this is filenames
with newlines, since xargs will take the newline as separator; you
would need -print0 on your find, and xargs0 instead of xargs (or an
equivalent option switch on your xarg).  Not too difficult to hack into
find and xarg free sources, and FSF's GNUfind already has -print0...

-- 
Alex Martelli - (home snailmail:) v. Barontini 27, 40138 Bologna, ITALIA
Email: (work:) martelli at cadlab.sublink.org, (home:) alex at am.sublink.org
Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; 
Fax: ++39 (51) 366964 (work only), Fidonet: 332/401.3 (home only).



More information about the Comp.unix.misc mailing list