bug-bash
[Top][All Lists]
Advanced

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

Re: command_not_found_handle and sourced script


From: Dan Douglas
Subject: Re: command_not_found_handle and sourced script
Date: Mon, 26 Dec 2016 17:23:50 -0600

On Mon, Dec 26, 2016 at 12:42 PM, Dominique Ramaekers
<dominique.ramaekers@crowdcloud.be> 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.



reply via email to

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