Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Jan 2002 19:53:52 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        David Miller <dmiller@sparks.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Overriding ARG_MAX
Message-ID:  <3C3678D0.49B77037@mindspring.com>
References:  <Pine.BSF.4.21.0201042145070.27496-100000@search.sparks.net> <20020104190303.A21307@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Brooks Davis wrote:
> > I have a system where I need/want to handle lots of files in a single
> > directory.  Lots as in 100-200K files.  ls | wc -l breaks because the
> > value of ARG_MAX in sys/syslimits.h is too small.  If I change it from
> > 65536 to 4meg and rebuild the world it works fine.
> 
> ls | xargs wc -l
> 
> would work with an arbitrary number of files.

No, it wouldn't.  First off, you would be line counting the file
contents, not the number of files.  Second, the "ls" command alone
will *never* hit ARG_MAX, and neither will "wc -l", if it's pipe'd
to to count the number of files.  He's obviously using a globbing
expression he's not telling us about, and the message is from the
shell expasion of the expression.

Thirdly, even if it was the number of lines in the files he wanted
to count, the totals will be off if xargs were to invoke "wc -l"
multiple times, so the command as written can't work anyway.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C3678D0.49B77037>