bash limits ?

Peter L. Peres plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Fri Sep 10 00:52:45 UTC 2004


On Thu, 9 Sep 2004, Henry Spencer wrote:

> On Thu, 9 Sep 2004, Peter L. Peres wrote:
>> Thanks. Is the argument list too long, as in too many words, or too many
>> bytes in it ?
>
> It can be either, in fact, although "too many bytes" is much more likely.
>
>> ./[0-9][0-9]/[0-9][0-9]/[0-9]{8}
>> I read the names of all these files using 'ls .' or equivalent...
>
> Uh, "or equivalent"?  What, exactly, is doing the name reading, and how?
> That is more likely to be the problem area than the shell.
>
>> I am not sure where it fails. I think that the argument list passed to for
>> is too long...
>
> "for" being a shell builtin, that basically shouldn't happen.  I don't say
> it's impossible, but it seems far more likely that you're being misled and
> the problem is elsewhere.

The exact command I'm using is:

SORTED=$(find $TMPDIR/* -type f|grep -E [0-9]+|cut -d'/' -f4|sort)

where the argument of find should expand to no more than 100 entries (102 
with . and ..). the entries are guaranteed unique so that's not a problem. 
The cut -f4 matches several slashes which are in TMPDIR and leaves just 
the [0-9]{8} filename part to sort. Unfortunately basename cannot be used 
in a pipe (why did they write it like that ? - I should write a 
replacement that can be used in a pipe !).

Peter
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list