Register
It is currently Thu Apr 24, 2014 12:15 am

exec echo - argument list too long


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Wed Apr 11, 2012 5:15 am   

Joined: Wed Apr 11, 2012 5:12 am
Posts: 4
I am getting an error:
Code:
catch: couldn't execute "echo": argument list too long
errorInfo:
couldn't execute "echo": argument list too long
    while executing
"exec echo "RES_loc='$RES'" >> $out_file"
    (in namespace eval "::" script line x)
invoked from within
"namespace eval :: ...{


This is because $RES contains a lot of strings and even error points to this command, this might get evaluated later in the script with eval.

There is an option but I do not want to trim the var.

I am starting to look into how to replace exec with xargs but not yet sure how to.

Can anybody give me an advice please on how to solve this error?


Top
 Profile  
 PostPosted: Wed Apr 11, 2012 5:53 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 512
I'm pretty sure `exec' is not what you need.
hard to say more without the script, and context.


Top
 Profile  
 PostPosted: Wed Apr 11, 2012 7:05 am   

Joined: Wed Apr 11, 2012 5:12 am
Posts: 4
Watael wrote:
I'm pretty sure `exec' is not what you need.
hard to say more without the script, and context.


It is not my script and it is like 200`000 lines!! o_O

Generally it works very well this exact command is executed many times successfully. Just once when "argument list is too long" - it fails like this.
ARG_MAX on my system is 131072 but I would not like to increase - rather to find a solution.


Top
 Profile  
 PostPosted: Thu Apr 12, 2012 4:28 am   

Joined: Wed Apr 11, 2012 5:12 am
Posts: 4
I am sorry - this is a TCL code that can use bash variables.


Top
 Profile  
 PostPosted: Thu Apr 12, 2012 7:13 am   

Joined: Wed Apr 11, 2012 5:12 am
Posts: 4
Anyway - solution:

[set variables before]

set outfile [open "$file" a]

puts $outfile RES_loc="$RES"
puts $file

close $outfile


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP