[TriLUG] Limit to command line arguments?

Rick DeNatale rick.denatale at gmail.com
Sat Oct 22 07:49:27 EDT 2005


On 10/21/05, Kevin Otte <nivex at nivex.net> wrote:
> Randy Barlow wrote:
> > What is the limit on the number of command line arguments you can pass
> > to a program (assuming use of bash).
>
> Yes, it's in the 200's somewhere (exact number I don't recall).
>
> > Are there other shells than bash
> > that give more?  I need to pass about 350 arguments to a program I am
> > working on, will this work?
>
> What you are looking for is a program called xargs.
>
> A sample execution would look like:
>
> cat long_list_of_filenames.txt | xargs someprogram
>
> This will append as many of the filenames as will fit in a standard
> command line to someprogram, and repeat as many times as necessary to
> complete the file.  The manual page should be able to give some more
> extended examples as needed.

I don't think that xargs will help in this case.   It really helps if
the program getting the arguments treats all of the arguments in the
same way and  it doesn't matter if you process the arguments in
chunks.  However, in a follow up to a question the OP described his
program as:

    It's a program that takes .STL CAD files as input as discritizes the
    solids in 3D space.

Which sounds to me as though it needs ALL of the arguments at once, or
at the very least the arguments would need to be chunked intelligently
so that the arguments related to a particular solid don't get split
between two invocations.  Unless we're talking about 300 cad files, in
which case I'll do my Emily Latella impression. <G>

It seems to me that the original question is one of those which needs
to be "unasked" (does anyone still read "Zen and the Art of Motorcycle
Maintenance" anymore?).  That much data really should be fed to the
program either via a file or stdin.

--
Rick DeNatale

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/



More information about the TriLUG mailing list