LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-09-2008, 12:36 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
How do you find the maximum length of a command line argument?


I have a little python script that takes a bunch of files & does stuff to them. One of the things it does it pass that list over to another program via popen (not that this matters).

The import part is that I use "getconf ARG_MAX" to find the max length for the argument list I pass to the other program, but I still get "Argument list too long" messages when I send really long file lists, even though the string I use to execute the other program is still shorter than what "getconf ARG_MAX" spits back.

Looking closer at getconf, it appears that this may be the max arg length when using some exec function rather than raw command line arguments.

Soo.... how does one find the maximum number of chars that can go on the command line when doing something on the command line?
 
Old 06-10-2008, 04:53 AM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 572

Rep: Reputation: 56
Just guesses here....

Are you getting the error when you perform a system call? If so, perhaps you should use xargs to process your argument list? If it possible to have a command line within limits but exceeding limits when it is expanded by shell expansion.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl command line argument noir911 Programming 8 01-15-2008 04:59 AM
What is the maximum length of a command? c_h_i_ll_a_x Linux - Newbie 8 07-04-2007 01:25 PM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
Command line tool to print length of mp3 files? J_Szucs Linux - Software 3 05-04-2004 05:01 AM
Command to list line length of multiple scripts Tekime Linux - General 2 09-06-2002 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:33 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration