Bash – why ‘echo –help’ doesn’t give me help page of echo

bashechoshell

I tried 'man echo' in Bash and it told me that 'echo –help' will display help then exit, and similarly, that 'echo –version' will output version and exit. But why it doesn't work ? 'echo –help' just simply prints '–help' literally.

Best Answer

man echo relates to the echo program. GNU echo supports a --help option, as do some others. When you run echo in Bash you instead get its builtin echo which doesn't.

To access the echo program, rather than the builtin, you can either give a path to it:

/bin/echo --help

or use Bash's enable command to disable the built-in version:

$ enable -n echo
$ echo --help

Bash has built-in versions of a lot of basic commands, because it's a little faster to do that, but you can always bypass them like this when you need to.

Related Question