title: bash - run script based on substring of filename (perhaps using wildcard)
body: <p>I've got the below simple script that calls an external script with a number of filenames and arguments of either a delimiter or a set of cut positions. My question: is there a way to make the filename 'dynamic using wildcards' in the sense that the directory will always contain those filenames but with extra text on either end? But the script can do some sort of match up to get the full filename based on a 'contains'.</p>
  
  <p>current /release/ext/ directory contents:</p>
  
  <pre><code>2011storesblah.dat
  hrlatest.dat
  emp_new12.txt
  </code></pre>
  
  <p>ie the directory contains these files today (but next week the filenames in this directory could have a slightly different prefix.
  eg:</p>
  
  <pre><code>stores_newer.dat
  finandhr.dat
  emps.txt
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code> #!/bin/bash
      FILES='/release/ext/stores.dat "|"
      /release/ext/emp.txt 1-3 4-11 15-40
      /release/ext/hr.dat "|" 2'
      for f in $FILES
      do
          echo `sh myexternalscript.sh $f`;
      done
  </code></pre>
  
  <p>Note: there is no need to handle a scenario where the file in my script matches more than 2 files in the direc (it will always only match one).
  Also it only can match the file types that are specified in the script.
  Also, I don't need to search recursively, just needs to look in the /release/ext/ directory only.
  I'm running SunOS 5.10.</p>