title: why does bash tell me that the command if is not found when I run the following code?
body: <p>sorry, I am relatively new to bash, but</p>
  
  <pre><code>if [ ! -d /home/$USER/testfoo ]; then mkdir /home/$USER/testfoo; fi
  </code></pre>
  
  <p>has the desired effect of making a directory testfoo if it does not exist</p>
  
  <p>but</p>
  
  <pre><code>TESTCMD="if [ ! -d /home/$USER/testfoo ]; then mkdir /home/$USER/testfoo; fi"
  $TESTCMD
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>if: command not found
  </code></pre>
  
  <p>What am I doing wrong?</p>