--- execute_cmd.c.orig 2004-04-04 15:40:18.000000000 +0200 +++ execute_cmd.c 2004-04-04 16:41:33.000000000 +0200 @@ -3270,8 +3270,23 @@ if (command == 0) { - internal_error ("%s: command not found", pathname); - exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */ + SHELL_VAR *f, *v; + WORD_LIST *cmdlist; + WORD_DESC *w; + int fval; + f = find_function ("command-not-found-handle"); + if (f == 0) { + internal_error ("%s: command not found", pathname); + exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */ + } + w = make_word("command-not-found-handle"); + cmdlist = make_word_list(w, (WORD_LIST*)NULL); + + w = make_word(pathname); + cmdlist->next = make_word_list(w, (WORD_LIST*)NULL); + + fval = execute_shell_function (f, cmdlist); + exit(fval); } /* Execve expects the command name to be in args[0]. So we