title: Bash shell...find command...names with wildcards...alias or function
body: <p>I've long used the find command for finding files and directories in the current directory and all subdirectories that match a pattern:</p>
  
  <pre><code>find . -name "*.txt" -print
  find . -name "Bill*" -print
  </code></pre>
  
  <p>But what I'd really like is an alias or function that will properly pass the wildcard.  (I used to be able to do this in csh, but now I'm using bash.)  If an alias or function named "fn" were set properly, I could save some time by just typing:</p>
  
  <pre><code>fn "*.txt"
  fn "Bill*"
  </code></pre>
  
  <p>Ideally, I'd like to lose the quotation marks too, but I'm guessing that might not be possible because the shell will expand them before calling "fn".</p>
  
  <p>Any advice would be greatly appreciated and will postpone carpal tunnel syndrome....  :)</p>
  
  <p>SOLVED: After the discussion below, I put this in my .bashrc file: </p>
  
  <pre><code>fn () {
    find . -name "$1" -print
  }
  </code></pre>
  
  <p>Note the quotes around the argument: "$1".  This can then be called with more quotes around the filename expression:</p>
  
  <pre><code>fn "*.txt"
  </code></pre>
  
  <p>EDIT: must have spaces between the function name and the parentheses, so
    fn () { ...   [works]
    fn() { ...    [doesn't work]</p>