Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there anywhere you can download a manpage for every builtin commands?

I know you can just use help or man bash and search to find info about it, but I want them separated, so I can just do man read and get the read manpage.

share|improve this question
It's not quite what you want, but on my Fedora 15 system, these are separated into separate man pages which reference a builtins (1) man page. This is still a big aggregate document, but at least it's just the builtins and not everything to do with bash. – mattdm Aug 4 '11 at 20:45
Doesn't work in Mac OS X – Tyilo Aug 4 '11 at 20:49

2 Answers

up vote 5 down vote accepted

Try this:

bashman () { man bash | less -p "^       $1 "; }

You may have to hit n a couple of times to get to the actual command instead of a paragraph that happens to have the command name as the first word.

share|improve this answer
Good idea. Not what I think Tyilo wants, but I'm not convinced I got that right. – Gilles Aug 4 '11 at 23:32
1  
Works perfect! Adding a space after $1 makes it better – Tyilo Aug 4 '11 at 23:35
help read
help read | less

In zsh:

run-help read

or type read something and press M-h (i.e. Alt+h or ESC h).

If you want to have a single man command so as not to need to know whether the command is a built-in, define this function in your ~/.bashrc:

man () {
  case "$(type -t "$1"):$1" in
    builtin:*) help "$1" | "${PAGER:-less}";;     # built-in
    *[[?*]*) help "$1" | "${PAGER:-less}";;       # pattern
    *) command -p man "$@";;  # something else, presumed to be an external command
                              # or options for the man command or a section number
  esac
}
share|improve this answer
Why do I neeed 2 more rep to downvote -.-' I wan to downvote because I said that I don't want to use help and help read, doesn't show what all options do. – Tyilo Aug 4 '11 at 20:55
@Tyilo help read does show what the options do. If the difference bothers you so much, switch to zsh, where run-help shows the same text that's in the man page. – Gilles Aug 4 '11 at 21:05
I just want to download the manpages somewhere, not use some weird command to simulate it. Alternative, I want to extract all the builtin functions from the bash manual and create a new manpage for each of them. – Tyilo Aug 4 '11 at 21:10
1  
@Tyilo, you could show a little respect for people trying to help you. – glenn jackman Aug 4 '11 at 23:12
@Tyilo I suggest clarifying your question. I think I understand what you're after from your comment here, but it's not what glenn and I understood from your question. Rather than speculate on what you'll really after, I'll let you edit your question if you really want it answered to your satisfaction. – Gilles Aug 4 '11 at 23:31
show 3 more comments

Your Answer

 
discard

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.