Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Unexpected Argument list too long error on later os level

Shell Programming and Scripting

solved, xargs arguments

Thread Tools Search this Thread Display Modes
Old Unix and Linux 01-10-2017   -   Original Discussion by say170
say170's Unix or Linux Image
say170 say170 is offline
Registered User
Join Date: Dec 2011
Last Activity: 10 January 2017, 6:05 AM EST
Posts: 28
Thanks: 6
Thanked 0 Times in 0 Posts
for info, I set -n 2000. 2250 failed.
Sponsored Links
Old Unix and Linux 01-10-2017   -   Original Discussion by say170
stomp's Unix or Linux Image
stomp stomp is offline
Registered User
Join Date: May 2016
Last Activity: 22 January 2018, 10:44 AM EST
Posts: 193
Thanks: 10
Thanked 67 Times in 62 Posts
I'd set the limit rather pessimistic. E. g. rather 500 than 2100, because it depends on the length of the parameters when the environment space is used up.

A parameter may be ...


or it maybe...


...and for sure check if it fails nevertheless.


But would it not be better to set the variables so that every command is happy with the limits and will work correctly with it? I do not yet now what variables to adjust so var. But fumbling around to set some limits that hopefully would not be hit seems not to be the cleanest way, despite it'll work 99% if you set the limits very conservative.


the man-page here shows:

xargs (GNU findutils) 4.4.2

       -s max-chars
              Use at most max-chars characters per command line, including the command and 
              initial-arguments and the terminating nulls at the ends of the argument strings.  
              The largest allowed value is system-dependent, and is calculated as the argument 
              length limit for exec, less the size of your environment, less 2048 bytes of 
              headroom.  If this value  is  more  than 128KiB, 128Kib is used as the default value; 
              otherwise, the default value is the maximum.  1KiB is 1024 bytes.

I would assume that --max-chars is more robust then --max-args

Last edited by stomp; 01-10-2017 at 07:38 AM..
The Following User Says Thank You to stomp For This Useful Post:
rbatte1 (01-10-2017)
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Argument list too long!! Naga06 Shell Programming and Scripting 2 07-11-2012 10:03 AM
Argument too long list error 22karthikreddy Shell Programming and Scripting 1 09-27-2010 02:12 AM
"Argument list too long" error mario8eren Shell Programming and Scripting 6 09-02-2010 06:40 AM
TAR Files Argument list too long error unx100 Shell Programming and Scripting 2 12-28-2009 08:24 AM
Argument list too long - Shell error dad5119 Shell Programming and Scripting 8 03-03-2006 03:57 PM

All times are GMT -4. The time now is 01:58 PM.