How to change size of command line in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to change size of command line in unix
# 1  
Old 07-27-2007
How to change size of command line in unix

Hi,

I'm trying to execute my program from $prompt by passing many parameters which is more than 300 charecters in line but unix not accepting those many charecters, could some one help me how to increase the size?

thanks
# 2  
Old 07-27-2007
what is the error that you get?

one alternative you can try is: keep your program name along with all arguements in a file and run that file (like a shell script)
# 3  
Old 07-27-2007
Can you replace some of the input with variables.

a="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
b="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
proc $a $b

or create a file with the input in it.
echo $a >temp.txt
echo $b >>temp.txt
proc <temp.txt
# 4  
Old 07-27-2007
You should try this solution too :
- create a file (named param.txt here) and put your 2 parameters inside (on 2 lines)
- execute your program 'prog.sh' :
prog.sh `cat param.txt | head -1` `cat param.txt | tail -1`
# 5  
Old 07-27-2007
Thanks for the reply, actually I'm looking for the configuration change, any idea where to change this to increase size of command line?
# 6  
Old 07-28-2007
Krishna,
As far I know, in POSIX UNIX, the value which control the arg length is _POSIX_ARG_MAX, whose max value can be found in /usr/include/limits.h which is 4096. In HP-UX 11 and above, this value is 2048000

Snippet from Man page of limits:
Code:
_POSIX_ARG_MAX         4096  /* max length of arguments to exec */

ARG_MAX
    Maximum length of argument to the exec functions including
 environment data. Minimum Acceptable Value: _POSIX_ARG_MAX

I am not sure how to change it, but I think you will need the kernel source and would have to change it and recompile the kernel to take effect.

Also remember that the env variables also are included in this 4096.

-GGR
# 7  
Old 07-29-2007
Could also be this line from the same file (limits.h)
#define MAX_INPUT 256 /* max size of a char input buffer */
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Change Name of Bluetooth Device from Command Line in macOS

Mac Version 10.15.2 (macOS Catalina) Does anyone know how to change the name of a connected bluetooth device from the command line on macOS? I am having trouble with various bluetooth devices which I cannot get the "rename" option in the GUI to "save" properly and so I cannot rename a few... (0 Replies)
Discussion started by: Neo
0 Replies

2. UNIX for Dummies Questions & Answers

Looking for command line to find dirs based on size and date

Hi, My first time on this site, please excuse me if I've come to the wrong forum. I'm fairly new to Unix/Linux and hoping you can help me out. I'm looking for a command line that will return a list of directories that are larger than 50M and older than 2 days. I thought it may be... (6 Replies)
Discussion started by: Wisconsingal
6 Replies

3. Shell Programming and Scripting

one line command to change mode only if necessary

hi, sorry for posting this for a quick answer. Is there a one line command to change permissions on files in a directory to a given mode (say 554) and only for those files that do not already have that mode? Running chmod updates the last access/modified timestamp on the files, and i want to... (11 Replies)
Discussion started by: ysrini
11 Replies

4. Programming

How to get the size of the datatype passed as the command line argumet?

#include <stdio.h> int main(int argc, char *argv) { printf("%d\n", sizeof(argv)); return 0; } when I run the executable a.out after compiling the above program as: a.out short (or) a.out "long double", I expected to get the output as 2 and 12, but I am always getting the size of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

5. Shell Programming and Scripting

Change filename extensions..from command line

I want to change the extensions of a folder full of files (some of the files are located in subfolders as well) to another extension, but instead of replacing the files I want the new files to be copied into a newly created folder. Here is the folder structure: /Downloads/3eb... (3 Replies)
Discussion started by: bound4h
3 Replies

6. Shell Programming and Scripting

Using sed command to change end of line

I am looking to change a data file into a javascript string and this is the code that I am using: sed -i '' -e 's/^/str += "/' -e 's/$/";/' file.xml The first part -e 's/^/str += "/' works as intended, but the second part -e 's/$/";/' adds an additional newline to my file, so that instead of... (3 Replies)
Discussion started by: figaro
3 Replies

7. Shell Programming and Scripting

Command/script to find size of Unix Box ?

Please could anyone provide me the Command/script to find the size and usage of Unix box ASAP ? (6 Replies)
Discussion started by: sakthifire
6 Replies

8. Shell Programming and Scripting

File size limitation of unix sort command.

hi , iam trying to sort millions of records which is delimited and i cant able to use sort command more than 60 million..if i try to do so i got an message stating that "File size limit exceeded",Is there any file size limit for using sort command.. How can i solve this problem. thanks ... (7 Replies)
Discussion started by: cskumar
7 Replies

9. Linux

How change GRUB command line to graphical interface?

Hi, I am i new Unix linux user. I've installed the linux 9 and i uninstall it. the first time i install the linux, the GRUB show the graphical interface. But after i reinstall it again, the GRUB change to command line. I can't boot my comp now. What should I do? And i don't know how to deal with... (4 Replies)
Discussion started by: lee_chongeu
4 Replies

10. Shell Programming and Scripting

How to change the GRUB command line to graphical interface?

Hi, I am i new Unix linux user. I've installed the linux 9 and i uninstall it. the first time i install the linux, the GRUB show the graphical interface. But after i reinstall it again, the GRUB change to command line. I can't boot my comp now. What should I do? And i don't know how to deal with... (1 Reply)
Discussion started by: lee_chongeu
1 Replies
Login or Register to Ask a Question