title: bash command substitution: find command with wildcard in single quotes
body: <p>I want to dynamically construct a "find" command and see whether it returns anything.</p>
  
  <p>This is the minimised example. In a directory containing files,</p>
  
  <pre><code>find . -name '*'
  </code></pre>
  
  <p>of course returns the files. But</p>
  
  <pre><code>VAR="find . -name '*'"
  $VAR
  </code></pre>
  
  <p>returns nothing. Looks like a problem of interpretation of quotes. But why?</p>
  
  <p>(The real case is that I want to see whether files with a certain prefix exist. So I intended to use <code>-name '${MYPREFIX}*'</code>, capture the output within <code>$()</code>, and test whether the resulting string is empty.)</p>
  
  <p>Apologies if this is trivial. I did spend time to find the answer, but all cases I found were somehow different. Usually, the problem is the shell expanding the wildcard when the find command should do it. Here, the shell does not do any premature expansion, but neither does find, maybe because find receives literal quotes? Thanks for any insight.</p>