Over on the James Britt blog there’s a post about hooking into the bash function command_not_found_handle to execute Ruby helper code.

The specific example is for interpreting a missing command as a Rake task name if the working directory has a Rakefile present.

Go read Getting lazy with bash