On macOS 10.14, using
whatis on a command that is not installed prints
'command': nothing appropriate as is expected. But returns 0 instead of an error code, which I believe is expected behavior. It is also not consistent with
man, which returns 1 after no results. Additionally,
whatis prints to stdout, while
man prints to stderr.
This is different than Linux, which returns an error code, and prints to stderr.
$ whatis abc; echo $? abc: nothing appropriate 0 $ man abc; echo $? No manual entry for abc 1 $ whatis abc 2>/dev/null abc: nothing appropriate $ man abc 2>/dev/null
$ whatis abc; echo $? abc: nothing appropriate. 16 $ man abc; echo $? No manual entry for abc 16 $ whatis abc 2>/dev/null $ man abc 2>/dev/null
whatis should not return 0 when it fails to find a description of the command, and should have behavior consistent with
Note: I noticed this because I'm writing a program that relies on this functionality
apropos has the same behavior as