Just wanted to point out this minor inaccuracy:

You will never get a command line overflow from
ls | xargs rm

By definition, xargs will run as many comands as it needs to without
generating a command line overflow ever. The only time that -n is needed
is if you're running a command which only takes a limited number of
arguments. Also, ten is a very small number for what the linux commandline
is capable of.

cd /usr/bin
ls | xargs echo | wc 

The result is 2 2044 17281. This means that for xargs to print out all of
the  filenames, it automatically generated 2 command lines. OTOH, you can
also say

ls | xargs -n 3000 | wc -l
and the command succeeds and prints out a 1. 

:-)

-- 
-Time flies like the wind. Fruit flies like a banana. [EMAIL PROTECTED]
-Stranger things have happened but none stranger than this. Steven W. Orr-
Does your driver's license say Organ Donor?Black holes are where God \
-------divided by zero. Listen to me! We are all individuals!---------

On Sun, 30 Apr 2000, Todd A. Jacobs wrote:

=>On Sat, 29 Apr 2000, Jon Nichols wrote:
=>
=>> sometimes, in directories with hundreds of thousands of files
=>> i'll try a big glob rm and get an error like 'Arguments too long'.
=>
=>man xargs. Note the -n option. Then try something like:
=>
=>      ls *March* | xargs -n 10 rm
=>
=>This will remove the files in chunks of ten, instead of building a command
=>line that is potentially too large. 
=>
=>


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to