title: Encapsulating strings of variables in bash
body: <p>So I misrepresented my issue due to over simplification in my <a href="https://stackoverflow.com/questions/42543298/how-do-i-pass-an-encapsulated-variable-into-a-new-environment/42543789#42543789">last question</a>.</p>
  
  <p>Here is a better representation of the problem:</p>
  
  <pre><code>#!/bin/bash -x
  
  REALTEST+=" TESTVAR=\"some spaced string\""
  REALTEST+=" TESTVAR2=\"some other spaced string\""
  
  env -i $REALTEST /bin/bash -l -c "echo \$TESTVAR"
  env -i '$REALTEST' /bin/bash -l -c "echo \$TESTVAR"
  env -i "$REALTEST" /bin/bash -l -c "echo \$TESTVAR"
  </code></pre>
  
  <p>Here is the output:</p>
  
  <pre><code>-bash-4.2$ ./test1.sh
  + REALTEST+=' TESTVAR="some spaced string"'
  + REALTEST+=' TESTVAR2="some other spaced string"'
  + env -i 'TESTVAR="some' spaced 'string"' 'TESTVAR2="some' other spaced 'string"' /bin/bash -l -c 'echo $TESTVAR'
  env: spaced: No such file or directory
  + env -i '$REALTEST' /bin/bash -l -c 'echo $TESTVAR'
  env: $REALTEST: No such file or directory
  + env -i ' TESTVAR="some spaced string" TESTVAR2="some other spaced string"' /bin/bash -l -c 'echo $TESTVAR'
  </code></pre>
  
  <p>Any idea how I can get REALTEST to look like:</p>
  
  <pre><code>env -i TESTVAR="some spaced string" TESTVAR2="some other spaced string" /bin/bash -l -c 'echo $TESTVAR'
  </code></pre>
  
  <p>I can edit REALTEST but not the echo.</p>