Re: command_not_found_handle and sourced script

2016-12-26 Thread Dan Douglas
On Mon, Dec 26, 2016 at 12:42 PM, Dominique Ramaekers
 wrote:
> As I understand it, the command_not_found_handle is not triggered on an
> unknown command in a shell script, run normally.

Where'd you here that? That's easy to test.

 $ bash <<<'command_not_found_handle () { echo "$FUNCNAME"; }; blah'
command_not_found_handle

Doesn't seem to matter.

> To my opinion, a sourced script (once debuged) shouldn't contain unknown
> commands. So the command_not_found_handle is not necessary.

It may. A shell script may be run in any unknown environment which may
not have the available commands in PATH or elsewhere. Originally
command_not_found_handle was added for features like ubuntu's default
package suggestions when run interactively, but it has been used for
other purposes.



command_not_found_handle and sourced script

2016-12-26 Thread Dominique Ramaekers

Hi,

I have a philosophical question regarding the function of the 
command_not_found_handle...


As I understand it, the command_not_found_handle is not triggered on an 
unknown command in a shell script, run normally.


Dough, it is triggered on an unknown command in a sourced script.

Is there a philosophy behind that?

To my opinion, a sourced script (once debuged) shouldn't contain unknown 
commands. So the command_not_found_handle is not necessary.


Greetings,

Dominique.