2

In this question the user is getting the error "not found". I realized that the error is "not found" instead of "command not found".

Are these two errors different? I'm not sure if I've just never paid attention to this before or if this is different.

Here's an example:

/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
2
  • 1
    To fix this error try apt-get install coreutils It's also useful to use dpkg -S using the missing command as the argument. – eyoung100 Sep 15 '15 at 0:04
  • @eyoung100 thanks, I used apt-file search and noticed bin and date are both part of coreutils and pidof is part of sysvinit-utils it's always cool to have more than one way to get the info – mchid Sep 15 '15 at 0:14
3

Its the difference between how bash and dash handle cases when a command is not found.

In bash, there is a function named 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
}

So in bash :

$ foobar
foobar: command not found

In case of dash, there is no such function defined and we get :

$ foobar
dash: 1: foobar: not found

As Ubuntu uses dash as the default shell for internal operations so when dash is parsing some script it would show its own format.

2
  • Awesome, I have seen this so many times before but just now noticed there was a difference, thanks! – mchid Sep 15 '15 at 0:00
  • @mchid Its basically the difference in response to the same event.. – heemayl Sep 15 '15 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.