title: Bash function to find newest file matching pattern
body: <p>In Bash, I would like to create a function that returns the filename of the newest file that matches a certain pattern.  For example, I have a directory of files like:</p>
  
  <pre><code>Directory/
     a1.1_5_1
     a1.2_1_4
     b2.1_0
     b2.2_3_4
     b2.3_2_0
  </code></pre>
  
  <p>I want the newest file that starts with 'b2'.  How do I do this in bash?  I need to have this in my <code>~/.bash_profile</code> script.</p>