2

I sometimes end up requesting the man page for a "basic" command like set or pushd that is built-in into the bash/zsh shell.

So I type:

man set

…and I end up here:

BASH_BUILTINS(1)            General Commands Manual           BASH_BUILTINS(1)

NAME
       bash,  :,  .,  [, alias, bg, bind, break, builtin, caller, cd, command,
       compgen, complete, compopt,  continue,  declare,  dirs,  disown,  echo,
       enable,  eval,  exec, exit, export, false, fc, fg, getopts, hash, help,
       history, jobs, kill, let, local, logout, mapfile, popd, printf,  pushd,
       pwd,  read, readonly, return, set, shift, shopt, source, suspend, test,
       times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait -
       bash built-in commands, see bash(1)

BASH BUILTIN COMMANDS
       Unless otherwise noted, each builtin command documented in this section
       as accepting options preceded by - accepts -- to signify the end of the
       options.   The  :, true, false, and test builtins do not accept options
       and do not treat -- specially.  The exit, logout, return,  break,  con‐
       tinue,  let,  and shift builtins accept and process arguments beginning
       with - without requiring --.  Other builtins that accept arguments  but
       are  not  specified  as accepting options interpret arguments beginning
       with - as invalid options and require -- to  prevent  this  interpreta‐
       tion.
       : [arguments]
              No  effect;  the command does nothing beyond expanding arguments
 Manual page set(1) line 1 (press h for help or q to quit)

…in a thing apparently called "General Commands Manual".

Now the problem is: This man page is without any value to me. I mean, it's very nice, well-written and detailed… actually, very detailed.

I know, I can search in man pages with / thanks to the default pager less), but that does not really help here, as such a common word/string as set appears often in the command. And yes, I've tried awkward things as putting spaces around, no, this does not help: in the text "<several spaces>set" is highlighted as I searched for it, but it is just the text at the top-left of a text block that reads "the value of the variable is<line break>set to value., so I just got the beginning of a line break."

So this is not productive, as I would have been faster searching for this problem online then, than using the man page. With "proper" man pages that do not have hundreds of commands/man pages combined, it would actually have been faster.

What I actually just want is that when I type man set this page opens, but it automatically scrolls to the command I've actually requested (i.e. set in this example).

That said alternative solutions to the problem (like splitting that huge man page, if such a thing is possible?!) are also appreciated.

I would prefer solutions for this problem for bash or zsh (or other shells, if it is such a specific problem.). However, I would obviously prefer a solution that works everywhere.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
rugk
  • 3,086
  • 1
    If you type help set, does it show something more useful? – Mark Plotnick Jan 20 '19 at 20:49
  • Actually, help set, run-help set (as proposed in the duplicates) or so, all present exactly the same as man here! Note I am using zsh. – rugk Jan 23 '19 at 15:21
  • 1
    OK, bash -c "help set" may be better. You may want to add the zsh tag to attract zsh-specific answers. – Mark Plotnick Jan 23 '19 at 16:55
  • @MarkPlotnick Despite whatever strange magic that happens there, it works! And yes, I could only add 5 tags, so I had to limit it.

    Feel free to post a real answer here… (or wait, ah, you cannot, because it is a dupe – so maybe at the duped question.)

    – rugk Jan 24 '19 at 23:09

0 Answers0