「見つかりません」エラーと「コマンドが見つかりません」エラーの違いは何ですか?どちらも同じですか?

「見つかりません」エラーと「コマンドが見つかりません」エラーの違いは何ですか?どちらも同じですか?

存在するこの問題ユーザーに「見つかりません」というエラーが表示されます。エラーは「コマンドが見つかりません」ではなく「見つかりません」ということに気づきました。

これら2つのエラーは異なりますか?以前にこの問題に注意を払ったことがないのか、それともこれが違いをもたらすのかは分かりません。

例は次のとおりです。

/etc/cron.daily/apt:
/etc/cron.daily/apt: 91: /etc/cron.daily/apt: date: not found
/etc/cron.daily/apt: 97: /etc/cron.daily/apt: rm: not found
/etc/cron.daily/apt: 448: /etc/cron.daily/apt: pidof: not found
xargs: rm: No such file or directory
/etc/cron.daily/apt: 176: /etc/cron.daily/apt: date: not found
/etc/cron.daily/apt: 176: /etc/cron.daily/apt: date: not found

ベストアンサー1

bashdashコマンドが見つからない場合の処理​​方法と処理の違いです。

にはbash次の関数がありますcommand_not_found_handle

$ 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
}

だからbash

$ foobar
foobar: command not found

そのような関数が定義されていない場合は、dash次のようになります。

$ foobar
dash: 1: foobar: not found

dashUbuntuは内部操作にデフォルトのシェルを使用するため、特定のdashスクリプトを解析するときに独自の形式を表示します。

おすすめ記事