Either way, it doesn't have that behavior like that for me on Debian: it behaves the same as bash. This is in dash:
$ command -v whoami /usr/bin/whoami $ echo $? 0 $ command -v echo echo $ echo $? 0 $ command -v nonexistent $ echo $? 127
Bash does exactly the same, although dash chooses 127 as exit status and bash chooses 1 but they're both nonzero (thus error statuses).
Either way, it doesn't have that behavior like that for me on Debian: it behaves the same as bash. This is in dash:
So that is with both a proper command (whoami), a shell built-in (echo), and neither (nonexistent). It's all as I would expect from a shell.Bash does exactly the same, although dash chooses 127 as exit status and bash chooses 1 but they're both nonzero (thus error statuses).