title: How do I write a bash alias/function to grep all files in all subdirectories for a string?
body: <p>I've been using the following command to grep for a string in all the python source files in and below my current directory:</p>
  
  <pre><code>find . -name '*.py' -exec grep -nHr &lt;string&gt; {} \;
  </code></pre>
  
  <p>I'd like to simplify things so that I can just type something like</p>
  
  <pre><code>findpy &lt;string&gt;
  </code></pre>
  
  <p>And get the exact same result. Aliases don't seem sufficient since they only do a string expansion, and the argument I need to specify is not the last argument. It sounds like functions are suitable for the task, so I have several questions:</p>
  
  <ul>
  <li>How do I write it?</li>
  <li>Where do I put it?</li>
  </ul>