Chris's Wiki :: blog/unix/ExecEnvironmentIssue Commentshttps://utcc.utoronto.ca/~cks/space/blog/unix/ExecEnvironmentIssue?atomcommentsDWiki2013-03-30T11:01:18ZRecent comments in Chris's Wiki :: blog/unix/ExecEnvironmentIssue.From 84.163.44.45 on /blog/unix/ExecEnvironmentIssuetag:CSpace:blog/unix/ExecEnvironmentIssue:b83d661d46a725c2342b26591b643fd6644e2799From 84.163.44.45<div class="wikitext"><p>Here is some sample code to illustrate the fact that it is a combination of arguments and environment variables that lead to 'Argument list too long' error messages.</p>
<p><a href="http://web.archive.org/web/20110716022320/http://codesnippets.joyent.com/posts/show/12334">http://web.archive.org/web/20110716022320/http://codesnippets.joyent.com/posts/show/12334</a></p>
<p><a href="http://www.in-ulm.de/~mascheck/various/argmax/">http://www.in-ulm.de/~mascheck/various/argmax/</a></p>
</div>2013-03-30T11:01:18ZBy Dan.Astoorian on /blog/unix/ExecEnvironmentIssuetag:CSpace:blog/unix/ExecEnvironmentIssue:6fdc0afc412fc7560164aabb67eac17813e94842Dan.Astoorian<div class="wikitext"><blockquote><p>(If you need to figure out what the big environment variables are in the Bourne shell, it is useful to know that the <code>export</code> command without any arguments lists all the environment variables, and it is a built-in command so you can still use it in this situation. If you are trying to use <code>tcsh</code>, you're on your own.)</p>
</blockquote>
<p>For <code>csh</code> or <code>tcsh</code>, <code>setenv</code> with no arguments will do it. For <code>tcsh</code> only, <code>printenv</code> is another builtin that will do the job.</p>
<blockquote><blockquote><p><code>BIGVAR='' command ...</code></p>
</blockquote>
</blockquote>
<p>The equivalent <code>csh</code> or <code>tcsh</code> idiom requires a subshell (which is okay, since the subshell is merely fork()d, not exec()d) if you only want the variable unset for the one command:</p>
<blockquote><p><code>( unsetenv BIGVAR; command ... )</code></p>
</blockquote>
<p>(<code>( setenv BIGVAR ''; command ... )</code> would be a more literal translation of the Bourne shell idiom, but removing the variable entirely is a little cleaner.)</p>
<p>--Dan</p>
</div>2007-06-13T14:18:38Z