title: GNU parallel inheriting environment variable while executing a local script
body: <p>Suppose I have <code>foo.sh</code> that calls <code>bar.sh</code> using parallel:</p>
  
  <pre><code># foo.sh
  
  #! /bin/bash
  
  parallel -N 3 bar.sh ::: $(seq 10)
  </code></pre>
  
  <p>My <code>bar.sh</code> works like this: if there is an environment variable (e.g. DEBUG=1) set, then it will output lots of debug info.</p>
  
  <p>Ideally I want to simply execute my <code>foo.sh</code> like such:</p>
  
  <pre><code>$ DEBUG=1 foo.sh
  </code></pre>
  
  <p>Normally, <code>foo.sh</code> has <code>$DEBUG</code> value, as well as <code>bar.sh</code> sees it. But now with me using GNU parallel to call <code>bar.sh</code>, which is a local program, my <code>bar.sh</code> no longer has the <code>DEBUG</code> value set.</p>
  
  <p>I read that <code>--env</code> only works if I had remote execution <code>-S</code> set, and from me trying it does not seem to work for me.</p>
  
  <p>Is there a way to get my parallel'ed <code>bar.sh</code> to simply "inherit" the environment settings of my <code>foo.sh</code>? I really don't want to spell out each and every environment variable and their values when calling <code>bar.sh</code> in parallel.</p>
  
  <p>TIA</p>