title: Why do quotes in shell scripts behave differently from quotes in shell commands?
body: <p>I'm using WSL (Ubuntu 18.04) on Windows 10 and <code>bash</code>.</p>
  
  <p>I have a file <code>filename.gpg</code> with the content:</p>
  
  <pre><code>export SOME_ENV_VAR='123'
  </code></pre>
  
  <p>Now I run the following commands:</p>
  
  <pre><code>$ $(gpg -d filename.gpg)
  $ echo $SOME_ENV_VAR
  '123' &lt;-- with quotes
  </code></pre>
  
  <p>However, if I run it directly in the shell:</p>
  
  <pre><code>$ export SOME_ENV_VAR='123'
  $ echo $SOME_ENV_VAR
  123 &lt; -- without quotes
  </code></pre>
  
  <p>Why does it behave like this? Why is there a difference between running a command using <code>$()</code> and running it directly?</p>
  
  <p>Aside: I got it working using <code>eval $(gpg -d filename)</code>, I have no idea why this works.</p>