[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: file_not_found_handle()

From: Ken Irving
Subject: Re: feature request: file_not_found_handle()
Date: Wed, 14 Aug 2013 11:48:41 -0800
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Aug 14, 2013 at 01:44:08PM +0200, Andreas Gregor Frank wrote:
> Hi,
> i think a file_not_found_handle() or a modified command_not_found_handle(),
> that does not need an unsuccessful PATH search to be triggered, would be
> useful and consistent.
> i found this old (Dec, 2009) discussion :
> http://gnu-bash.2382.n7.nabble.com/command-not-found-handle-not-called-if-command-includes-a-slash-tp7118.html
> Why are the patches not part of the bash?
> Use case:
> -see: command_not_found_handle()

It didn't occur to me to see if there was a file_not_found_handle() hook,
but I'd use it if available.  I use the command_not_found_handle() all the
time in my 'thinobject' object-oriented shell system, but need to avoid
slashes to invoke the hook per the subject 'bug' (still not sure it's really
a bug).

    $ declare -f command_not_found_handle
    command_not_found_handle () 
        exec /opt/bin/tob "$@"

The tob program looks for a special file to infer the type of an object,
and works if either / or . delimits objects, e.g.,

    $ tob rooftop.ingest.types
    $ tob rooftop/ingest.types

But the handler is not invoked in the latter case.

    $ rooftop.ingest.types
    $ rooftop/ingest.types
    -su: rooftop/ingest.types: No such file or directory

It'd be great to have this fixed, or to have a file_not_found_handle().
But given that the first entry on a command line pretty much has to be
a command, I'm not sure it makes sense to invoke file_not_found_handle()
in this case, or whether it might be confusing as to when it gets invoked.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]