title: Bash - reading wildcard patterns from a file into an array
body: <p>I want to read a list of patterns that may (probably do) contain wildcards from a file</p>
  
  <p>The patterns might look like this:</p>
  
  <pre><code>/vobs/of_app/unix/*
  /vobs/of_app/bin/*
  </code></pre>
  
  <p>etc</p>
  
  <p>My first attempt was to do this:</p>
  
  <pre><code>old_IFS=$IFS
  IFS=$'\n'
  array=($(cat $file))
  </code></pre>
  
  <p>This worked fine when the patterns did not match anything in the filesystem, but when they did match things in the filesystem, they got expanded so instead of containing the patterns, my array contained the directory listings of the specified directories.  This was no good.</p>
  
  <p>I next tried quoting like this</p>
  
  <pre><code>array=("$(cat $file)")
  </code></pre>
  
  <p>But this dumped the entire contents of the file into the 0th element of the array.</p>
  
  <p>How can I prevent it from expanding the wildcards into directory listings while still putting each line of the file into a separate array element?</p>