Reputation: 2357
I wrote a bash script and below is the sample snippet that gives "Argument list too long" error.
param1=$1
param2=$2
'set ${param1} "${param2}"'
I know the size of param2 is huge (approx 15MB and can be more as well). I read several posts about ARG_MAX and breaking down things to smaller components.
getconf ARG_MAX
67108864
Here the ARG_MAX size can easily accommodate something of size 15MB at least. So I am not sure what exactly is wrong here. Also, I am not sure if I can break this command down into smaller blocks. It's just one command which sets the whole value in one attempt.
I also ran the below command to check data limits:
ulimit -d
unlimited
Here we have unlimited size as well. Does anyone know how exactly I can bump up OS's limit to run these large commands? I am using CentOS Linux release 7.5.1804 (Core) with Kernel: 4.18.9.
Upvotes: 3
Views: 2455
Reputation: 116640
From https://www.in-ulm.de/~mascheck/various/argmax/ :
as additional limit since 2.6.23, one argument must not be longer than MAX_ARG_STRLEN (131072).
So you might want to try:
cat file.txt | set -r x
Upvotes: 1