# Michael Weber # ripped from command-not-found by (c) Zygmunt Krynicki 2007, # Licensed under GPL, see COPYING for the whole text # Pseudo-namespace cnf_ function cnf_preexec() { typeset -g cnf_command="${1%% *}" typeset -g cnf_command_all="$@" } function cnf_precmd() { (($?)) && { #echo $cnf_command failed if whence -- "$cnf_command" >& /dev/null ; then # regular command just failed elif egrep -r "^Host .*$cnf_command.*" ~/.ssh/config >/dev/null ; then ssh $cnf_command_all fi unset cnf_command } } typeset -ga preexec_functions typeset -ga precmd_functions preexec_functions+=cnf_preexec precmd_functions+=cnf_precmd