2012-08-16 44 views
0

我試圖讓我的科學Linux中的command_not_found_handle工作。我安裝了command-not-foundBASH command_not_found_handle() - 不建議解決方案

`sudo yum install PackageKit-command-not-found.x86_64` 

現在如果我發出type command_not_found_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類似的東西,我得到:

[email protected]:~$ gcl 
The program 'gcl' is currently not installed. You can install it by typing: 
sudo apt-get install gcl 

我想在Scientific Linux中獲得類似的功能。我如何設置?

謝謝。

+0

您是否嘗試履行給定的條件? – 2012-08-16 15:39:10

+0

我不太清楚「履行條件」的含義。我沒有太多的shell腳本經驗,所以我正在破譯腳本。 – JmZ 2012-08-16 16:33:57

+0

您可能需要安裝軟件包並運行dbus守護進程,該進程被配置爲將其接口放置在/ var/run/dbus/system_bus_socket中(通過符號鏈接) – fork0 2012-08-17 07:18:49

回答

1

在我運行Linux Mint的,14和16,和我command_not_found_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 
} 

該腳本引用this page,其中有一個壓縮包下載軟件,應該有你的一切需要。

相關問題