[TriLUG] Re: argument list too long

James Manning jmm at sublogic.com
Thu Aug 7 13:32:16 EDT 2003


> I like that workaround suggested by Joseph Tate:
>   ls | xargs -n 1 <WHATEVER>

FWIW, xargs has a built-in size limit (20k iirc) which is nice since
it's the size limit you're generally hitting.

So, if I have something to run on all the files:

ls | xargs <WHATEVER>

that'll generally get you the least number of times for having to run
the "WHATEVER" (assuming it's something you can't tell to recursive do
current dir or something similar).  Many times this'll mean running
the "WHATEVER" 10 or 12 times instead of 10000, but if the "WHATEVER"
is something that can only do one at a time, -n 1 is still the way to
go, of course :)
-- 
James Manning <http://www.sublogic.com/james/>
GPG Key fingerprint = B913 2FBD 14A9 CE18 B2B7  9C8E A0BF B026 EEBB F6E4



More information about the TriLUG mailing list