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 Telemetry-CR1000-Site:Directory:Object $ tob rooftop/ingest.types Telemetry-CR1000-Site:Directory:Object But the handler is not invoked in the latter case. $ rooftop.ingest.types Telemetry-CR1000-Site:Directory:Object $ 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. Ken