title: Adding .env vairables to run in for a given command
body: <p>I have a .env file with variables in it like this:</p>
  
  <pre><code>HELLO=world
  SOMETHING=nothing
  </code></pre>
  
  <p>I found this awesome script the other day, that puts these variables into the current session so when I run something like this</p>
  
  <pre><code>$(cat ./.env | grep -v ^# | xargs) &amp;&amp; node test
  </code></pre>
  
  <p>Then I can access the variables in the <code>test.js</code> node file.</p>
  
  <pre><code>console.log(process.env.HELLO)
  console.log(process.env.SOMETHING)
  </code></pre>
  
  <p>The problem with this is that that command puts the .env variables in the entire session so when I run <code>node test</code> without <code>$(cat ./.env | grep -v ^# | xargs)</code> after I run it, it will still have access to those variables, I'm writing a node.js test that accounts for these variables and I'd love to be able to run the same command with and without these .env variables without worrying if they are still in the session. Ideally I want to run </p>
  
  <pre><code>put-env-variables-for-this-command-first-command node test &amp;&amp; node test
  </code></pre>
  
  <p>And have the env variables only be available in the test script the first time it runs.</p>