Op 27-12-16 om 00:23 schreef Dan Douglas: > On Mon, Dec 26, 2016 at 12:42 PM, Dominique Ramaekers > <dominique.ramaek...@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.
When I do this test... $function command_not_found_handle { echo mycnf; } $echo -e '#!/bin/bash\nlss' > test $chmod +x test $./test ./test: line 2: lss: command not found $. ./test mycnf ... I first thought you were wrong. But then I did this: $ echo -e '#!/bin/bash\ntype command_not_found_handle' > test $ ./test ./test: line 2: type: command_not_found_handle: not found $ . ./test command_not_found_handle is a function command_not_found_handle () { echo mycnf } Apparently, in a non-interactive shell, the command_not_found_handle isn't set on my system (ubuntu). So I hope you understand my confusion earlier... I found in .bashrc these lines: # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac And in /etc/bash.bashrc some similar lines. So... You actually are completely right. Thanks for the help, Dan.