title: Bash: Brace expansion in scripts not working due to unwanted escaping
body: <p>I want to do something like this in a bash script. I'm using <code>bash 4.1.10</code>.</p>
  
  <pre><code># rm -rf /some/path/{folder1,folder2,folder3}
  </code></pre>
  
  <p>Works nicely (and as expected) from the shell itself. It deletes the 3 desired folders leaving all others untouched.</p>
  
  <p>When I put it into script something unwanted happens. For example, my script:</p>
  
  <pre><code>#!/bin/bash
  set -x
  VAR="folder1,folder2,folder3"
  rm -rf /some/path/{$VAR}
  </code></pre>
  
  <p>When I execute this script, the folders are not deleted.  </p>
  
  <p>I think this is due to the fact that some unwanted quoting is occurring. Output from the script using <code>#!/bin/bash -x</code>:</p>
  
  <pre><code>rm -rf '/some/path/{folder1,folder2,folder3}'
  </code></pre>
  
  <p>which of course cannot succeed due to the <code>'</code> marks. </p>
  
  <p>How can I get this working within my script?</p>