BASH命令\u未\u找到\u句柄()--不建议解决方案

BASH命令\u未\u找到\u句柄()--不建议解决方案,bash,built-in,Bash,Built In,我试图让命令\u not\u found\u handle在我的科学Linux中工作。我安装了未找到的命令包 `sudo yum install PackageKit-command-not-found.x86_64` 现在如果我发出type命令\u not\u found\u handle我会得到: [JmZ:/usr/lib]-->type command_not_found_handle command_not_found_handle is a function command

我试图让
命令\u not\u found\u handle
在我的科学Linux中工作。我安装了未找到的
命令

`sudo yum install PackageKit-command-not-found.x86_64` 
现在如果我发出
type命令\u not\u found\u handle
我会得到:

[JmZ:/usr/lib]-->type command_not_found_handle
command_not_found_handle is a function
command_not_found_handle ()
{
    runcnf=1;
    retval=127;
    [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0;
    [ ! -x /usr/sbin/packagekitd ] && runcnf=0;
    if [ $runcnf -eq 1 ]; then
        /usr/libexec/pk-command-not-found $1;
        retval=$?;
    else
        echo "bash: $1: command not found";
    fi;
    return $retval
}
我在安装软件包之前没有看到它。如果我现在为一些未安装的程序(如gcl)发出命令,我只会得到以下信息:

[JmZ:/usr/lib]-->gcl
Command not found.
然而,如果我在Ubuntu中做类似的事情,我会得到:

JmZ@ubuntu:~$ gcl
The program 'gcl' is currently not installed.  You can install it by typing:
sudo apt-get install gcl
我希望在Scientific Linux中获得类似的功能。我该如何设置


谢谢。

目前我正在运行Linux Mint,版本介于14和16之间,我的
命令\u not\u found\u handle
如下:

command_not_found_handle is a function
command_not_found_handle () 
{ 
    if [ -x /usr/lib/command-not-found ]; then
        /usr/bin/python /usr/lib/command-not-found -- $1;
        return $?;
    else
        return 127;
    fi
}

该脚本引用了一个tarball下载,它应该包含您需要的所有内容。

您尝试过满足给定的条件吗?我不太明白您所说的“满足给定的条件”是什么意思我没有太多的shell脚本编写经验,所以我正在破译脚本。您可能需要安装packagekit和一个正在运行的dbus守护进程,配置为将其接口放置在/var/run/dbus/system_总线_套接字中(通过符号链接)