LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2006, 03:15 PM   #1
kd5pbo
Member
 
Registered: Jun 2006
Location: Washington, DC, USA
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
Linux command line arguments


Is there a way to increase the number of command line arguments that can be passed to a program. Ideally, I'd like to be able to pass any arbitrary number of aruments, but in practise, 20,000 or so is what I need.
 
Old 09-04-2006, 03:24 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
That would be a very uncommon usage. Usually people would start using xargs
or something in that scenario. What are you trying to do?


Cheers,
Tink
 
Old 09-04-2006, 04:37 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Your systems maximum is $(getconf ARG_MAX)*. I agree 20K args in one go is not part of any realistic solution, regardless of the problem. You prolly need some preprocessing done.
 
Old 09-04-2006, 08:30 PM   #4
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
Hi,
kd5pbo, when you run that getconf ARG_MAX call you'll get 131072 and thats bytes max for all aguments plus environment, its not actual number of arguments you can pass directly.

In practice people solve this type of problem by passing the name of a configuration file on the command line and the program opens this file for reading to get the 20000 or so lines of data.

Edit: or pass it to the program on stdin

Last edited by randyding; 09-04-2006 at 08:31 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to increase command line Arguments Size in UNIX/LINUX??? sunilvadranapu General 10 03-31-2009 11:47 AM
command line arguments nickraj Programming 6 09-11-2006 01:01 PM
command line arguments containing ( Lotharster Linux - Newbie 3 01-05-2006 08:43 AM
Awk command-line arguments lowpro2k3 Programming 1 03-28-2005 09:09 PM
Help with command line arguments ? synapse Linux - Newbie 2 02-23-2004 02:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration