Bash – How to match name exactly with Bash’s `help` builtin

bashdocumentation

It seems the Bash built-in help command help does some really strange globbing:

  • help read shows the documentation for read, readarray and readonly.
  • help rea? shows only the documentation for read.
  • help 'read$' doesn't work.
  • help read | sed '/^read[^:]\+/,$d' is just silly.

Is there some more intuitive way to get only the read output?

Best Answer

It seems by defaul help foo is actually equivalent to help foo*. But if some special globbing characters are used then the ending "*" is not implicitely added.

So, a possibility would be help [r]ead.

The globbing used is the one used by the shell for file matching; afaik there isn't any equivalent of \< nor \>.

Related Question