help-bash
[Top][All Lists]
Advanced

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

Re: How to call something when a command is not found?


From: Eli Schwartz
Subject: Re: How to call something when a command is not found?
Date: Tue, 9 Mar 2021 18:10:59 -0500

On 3/9/21 5:31 PM, Peng Yu wrote:
> My question was to Marco. You don't need to reply it.

If you reply to the public mailing list, you should not be surprised
when people respond to you.

Also apparently I did not get any mail delivered from Marco until just
now... unsure why.

Also, garbled top posting... I don't read the thing you're responding to
when you do that.

> command_not_found_handle does call /usr/lib/command-not-found. I don't
> understand why there is a difference in the output when I directly
> call /usr/lib/command-not-found or let bash call
> command_not_found_handle.

Perhaps you could debug this, by running "set -x; shc" and watching the
command_not_found_handle execute with debug traces.

> $ type command_not_found_handle
> command_not_found_handle is a function
> command_not_found_handle ()
> {
>     if [ -x /usr/lib/command-not-found ]; then
>         /usr/lib/command-not-found -- "$1";
>         return $?;
>     else
>         if [ -x /usr/share/command-not-found/command-not-found ]; then
>             /usr/share/command-not-found/command-not-found -- "$1";
>             return $?;
>         else
>             printf "%s: command not found\n" "$1" 1>&2;
>             return 127;
>         fi;
>     fi
> }


-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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