Re: command_not_found_handle not called if command includes a slash

2009-12-27 Thread Jan Schampera
Ken Irving schrieb:

 Description:
 I'm not sure this is a bug, but I notice that the
 command_not_found_handle function is not called if the command has a
 slash in it.  I can't find anywhere in the bash source producing the
 No such file ...  error message, so I guess this is being caught
 somewhere else before bash gets the command line to process.
 
 The behavior is not new; a second example is included below from v3.2,
 showing the same error message when the bad command looks like a path.
 
 I'd like to dig into this, to see if there's any hope of hooking into
 this case in order to provide a handler, but have no idea where to look.
 Is there any hope for this?

From what I can see, the hook function is only triggered when a PATH
search returns no result. A given relative or absolute filename doesn't
trigger a PATH search.




Re: set -e (errexit) does not work in subfunctions when a return result is checked

2009-12-27 Thread Chet Ramey
On 12/24/09 3:35 PM, Krzysztof Oledzki wrote:

 Bash Version: 4.0
 Patch Level: 35
 Release Status: release
 
 Description:
 set -e (errexit) does not work in subfunctions when
 caller checks for a return result
 
 Repeat-By:
 ---cut here ---
 #!/bin/sh
 
 f() {
   set -e
   ls this-file-does-not-exist
   echo should not hapen
 }
 
 echo Try #1
 f || echo failed
 
 echo Try #2
 f

Since the first call to f takes place on the left of a `||', set -e has
is ignored during its execution, and enabling it has no effect (though,
since settings are global, it remains enabled after the function returns).

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: command_not_found_handle not called if command includes a slash

2009-12-27 Thread Chet Ramey
On 12/27/09 4:30 AM, Jan Schampera wrote:

 From what I can see, the hook function is only triggered when a PATH
 search returns no result. A given relative or absolute filename doesn't
 trigger a PATH search.

Quite true.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/