[TriLUG] Limit to command line arguments?

Kevin Otte nivex at nivex.net
Fri Oct 21 20:27:01 EDT 2005


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.

HTH.

-- Kevin



More information about the TriLUG mailing list