title: How to echo directories containing matching file with Bash?
body: <p>I want to write a bash script which will use a list of all the directories containing specific files. I can use <code>find</code> to echo the path of each and every matching file. I only want to list the path to the directory containing at least one matching file. </p>
  
  <p>For example, given the following directory structure:</p>
  
  <pre><code>dir1/
      matches1
      matches2
  dir2/
      no-match
  </code></pre>
  
  <p>The command (looking for <code>'matches*'</code>) will only output the path to <code>dir1</code>.</p>
  
  <p>As extra background, I'm using this to find each directory which contains a Java .class file.</p>