0

I know that whatis command is used to output a brief description about an executable program (Command).

So both

whatis cd

whatis type

Will print: nothing appropriate (Because from my understanding they are both shell builtins). However how come, it works for

whatis echo

even though, echo is a shell builtin, is there any explanation for that ?

2

This works for echo because is both a shell builtin and a command. By default, the builtin is used.

$ type echo
echo is a shell builtin
$ type -P echo # ignores builtins
/bin/echo
$ echo foo # builtin
foo
$ /bin/echo foo # external command
foo
|improve this answer|||||
  • type does not implement options and command echo executes the builtin command. – schily Dec 26 '15 at 22:50
  • @schily I removed the command example. What do you mean type does not implement options? POSIX doesn't require it to support options, but it does in bash, and zsh. It exists in the answer for demonstration. – jordanm Dec 26 '15 at 23:13
  • bash and zsh are not typical POSIX shells and never have been tested for POSIX compliance. POSIX does not mention options and the Bourne Shell and ksh88 do not implement options. For this reason, it does not help to mention vendor specific options. – schily Dec 27 '15 at 22:38

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.