title: Bash wildcard working in command line but not script
body: <p>I've a basic <code>ls</code> command I'm running in my command line <code>$ ls [root]/*</code>, from which I can see the contents of my <code>$root</code> directory. But, when I run the same command in a script, I see this error: <code>ls: [root]/*: No such file or directory</code>. I'm going to paste the script below, but is someone able to tell why the command is running fine in the command line but not the script? Thank you.</p>
  
  <pre><code>#! /bin/bash
  
  root="[root]"
  ls "$root/*"
  </code></pre>
  
  <p><strong>edit:</strong></p>
  
  <p>I tracked down the problem. The wildcard should <em>not</em> be inside the double quotes unless I'm looking for a file or directory with that name. The script below runs successfully.</p>
  
  <pre><code>#! /bin/bash
  
  root="[root]"
  ls "$root/"*
  </code></pre>