I have a ksh shell script and i need to pass arguments which are generated by data pulled from a database.
When the argument to the shell script is too long (about 4000 charecters) the below is the issue observed.
I copy the command which is 4000 charecters long from the logs and paste it for the ksh shell on my RedHat linux; then only part of the command (not the complete copied command text) gets pasted
Can you please help increase / tweak some settings so I can simply copy paste and execute the shell script irrespective of the command length or atleast increase it to a substantial length?
Below are the details:
# getconf LINE_MAX
2048
# getconf ARG_MAX
51200000
# getconf _POSIX_ARG_MAX
51200000
Linux mymac 3.10.0-957.12.1.el7.x86_64 #1 SMP Wed Mar 20 11:34:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
However, I did not find any of the above variable in /usr/include/limits.h file.
I'm not sure what value I should change and in which file ?
Note: the issue of not being able to paste the entire command only happens with ksh shell. The problem is not seen with bash shell.
It's a hardcoded limit, not something trivially changed. Even if you coerce getconf into changing, it won't be reflected in programs. But I suspect you're using a crusty old pdksh/ksh88, newer ksh is quite willing to accept enormous arguments on Linux.
Maybe you hit the LINE_MAX=2048 ?
This should be the buffer for a physical line (usually an input line).
Try to construct a longer virtual line by inserting a \ at the very end of the physical line, and continue on the next physical line.
For example
I've verified that it's not cheating in my case by having the script print an extra character. The count would be out several more if ksh were being run repeatedly.
To repeat: It's not a setting, it's hardcoded. Changing it won't change programs. You'd just make it lie.
It might be possible to build a custom ksh with a higher setting but that sounds far more difficult(installing compilers, headers, installing things in custom paths) than just getting the newer ksh which already does what you want. What version of ksh are you using? ksh --version