lkml.org 
[lkml]   [2000]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Argument list too long: out of environment space
Stuart Inglis wrote:
>
> Hi all,
>
> I have 9600 files in a directory and have troubles processing them. I
> thought it was a bash problem but Chet Ramey kindly informed me that
> it's a Linux kernel limitation.
>
> bash-2.03$ cd tttt/
> bash-2.03$ echo * | wc
> 1 9569 279676
> bash-2.03$ getconf ARG_MAX
> 131072
> bash-2.03$ grep hello *
> bash: /bin/grep: Argument list too long
> bash-2.03$ sort *
> bash: /bin/sort: Argument list too long
> bash-2.03$
>
> Why is this limit so small? There are only 9600 files taking a total of
> less than 300k to specify all of the names. The machine has 100's of Mb
> of RAM. Is it easy to change/fix?
>

[...and later...]

> Usually I get around problems like this by passing `echo *` into head or
> tail +N etc. xargs isn't an option due to the massive startup times of
> our custom commands.
>
> This is actually a small example... we often have more files than this
> :-)

You actually show the solution to your problem.
echo * | wc
worked, right? So pass your list of files to your apps the same way,
namely as a list to stdin. (And if that's not an option, you can always
add a -f <filename> flag to your custom commands where the file holds
the list of files you're working with.) Since we're dealing with
"custom commands" you should be able to customize them accordingly.

^C-ya

Eli
--
Eli Carter
eli.carter@inet.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.190 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site