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


Tags
solved, xargs arguments

Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 01-10-2017
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
    #9  
Old Unix and Linux 01-10-2017
stomp stomp is offline
Registered User
 
Join Date: May 2016
Last Activity: 28 March 2017, 6:48 AM EDT
Posts: 181
Thanks: 9
Thanked 65 Times in 60 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 ...

Code:
~/toCopy/short

or it maybe...

Code:
~/toCopy/some_filenames_are_really_long_and_if_you_do_not_know_how_long_the_space_is_eaten_up_with_few_parameters

...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:

Code:
xargs (GNU findutils) 4.4.2

       --max-chars=max-chars
       -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 06:38 AM..
The Following User Says Thank You to stomp For This Useful Post:
rbatte1 (01-10-2017)
Sponsored Links
Reply

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 09:03 AM
Argument too long list error 22karthikreddy Shell Programming and Scripting 1 09-27-2010 01:12 AM
"Argument list too long" error mario8eren Shell Programming and Scripting 6 09-02-2010 05:40 AM
TAR Files Argument list too long error unx100 Shell Programming and Scripting 2 12-28-2009 07:24 AM
Argument list too long - Shell error dad5119 Shell Programming and Scripting 8 03-03-2006 02:57 PM



All times are GMT -4. The time now is 01:18 AM.