Posted over 9 years ago. Visible to the public.

"command not found" bash function

If you type a command in your bash that doesn't exist you get this:

Copy
bash: foo: command not found

or if you have installed the command-not-found package on ubuntu/debian:

Copy
The program 'foo' can be found in the following packages: * foobar * barfoo Try: sudo apt-get install <selected package> -bash: foo: command not found

But you can customize this with the command_not_found_handle function which you can add to your .bashrc.

This is something I've tried:

Copy
function command_not_found_handle { ssh $@ }

Now I just have to type hostnames and get connected with ssh. Because I'm using $@ I can also use options like a custom ssh-port.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Avatar
Kim Jahn
Last edit:
over 9 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Kim Jahn to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more