title: How can I suppress Unix's "command not found" output?
body: <p>My goal: when I type in something that's not a valid Unix command, it gets fed to a special function instead of displaying the "Command not found" message.</p>
  
  <p>I found <a href="http://speaking-my-language.blogspot.com/2008/06/command-not-found-handler-not-only-in.html" rel="nofollow">this post</a>, which got me halfway there.</p>
  
  <pre><code>trap 'if ! type -t $BASH_COMMAND &gt;/dev/null; then special_function $BASH_COMMAND; fi' DEBUG
  </code></pre>
  
  <p>This allows me to run my special function. However the "Command not found" error still appears afterwards.</p>
  
  <p>Is there any way I can tell Bash to suppress that message?  Either in this command, or inside the special function, would be fine.  Thanks!</p>