Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
It seems they have fixed this annoying behaviour with the implicit * at the end if there is an exact match, (at least as of version version 4.3.42). In my version of bash help read shows only the documentation for read, but help read would show the documentation for read, readarray, etc. – Elmar Zander Nov 27 '15 at 8:25
up vote 3 down vote accepted

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 \>.

share|improve this answer
It's globbing, just like filename completion, but it is expanded after you enter it, and I don't see anyway to control it (see builtins/help.def, it's a for() loop over all builtins). Since [] trumps *, [r]ead gets my vote. read, time and type are the only problematic complete commands (and the two types of for if you're a pedant). – mr.spuratic Feb 25 '13 at 21:43
Accepting since it also works for help [s]et. – l0b0 Feb 26 '13 at 7:54

Luckily there's nothing else ending in ...read so this should work:

help *read
share|improve this answer
+1 This is a good solution, but setting Pablo's as accepted since it also works for commands which end with the same string like set. – l0b0 Feb 26 '13 at 7:53

pipe the output of help through a small awk script:

help () {
    builtin help "$1" |
    awk -F: -v command="$1" '
        p && /^[^[:space:]]/ {exit}
        $1 == command {p = 1}

Now help read will only give you the help for the read builtin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.