[TriLUG] Limit to command line arguments?

Corey Mutter corey at mutternet.com
Mon Nov 14 14:49:04 EST 2005


On Fri, Oct 21, 2005 at 06:57:33PM -0400, Randy Barlow wrote:
> What is the limit on the number of command line arguments you can pass 
> to a program (assuming use of bash).  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?

find and xargs will help you out here. 

To have your program called 350 times, once for each file, do this. This 
also processes the entire tree under where you are; if you don't want 
that, add "-maxdepth 1" to the command line.  

find . -name "*.CAD" -print | xargs -n 1 my_program

To have your program run 750 times, with 5 arguments at a time, replace 
"-n 1" with "-n 5". 

etc. etc. 

Corey

> 
> Randy
> -- 
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/



More information about the TriLUG mailing list