Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: command-not-found handler



On 2007-07-11 at 12:16 +0100, Peter Stephenson wrote:
> if this turns out to be useful.  (Note I called it _handle*r* since that
> seemed more natural.  A handler is something that handles an error.  A
> handle is a reference to a data structure.  If it means
> handle_command_not_found it should say so.  However, that's just me being
> picky and I'm not particularly bothered.)

> +If no external command is found but a function tt(command_not_found_handler)
> +exists the shell executes this function with all
> +command line arguments.

I think that the Debian bash extender was just as picky.

  command_not_found_handle
    The name of a shell function to be called if a command cannot be
    found. The return value of this function  should be  0,  if the
    command is available after execution of the function, otherwise 127
    (EX_NOTFOUND).  Enabled only in interactive, non POSIX mode shells.
    This is a Debian extension.

So I interpret that as meaning:
  unsplat_my_goofs() { blah; return 127; }
  command_not_found_handle=unsplat_my_goofs

However, I'm unable to get this to actually work on the Ubuntu-derived
distribution I'm using.

-Phil



Messages sorted by: Reverse Date, Date, Thread, Author