Man pages for Git Bash on Windows 7
It may be a bit overkill, but you could download Cygwin which would include bash
, man
, and info readers like pinfo
.
The cygwin installer would let you customize your install to be a pretty small subset of cygwin.
You can get man pages working on Git's bash environment, but it's probably more convenient to consider other alternatives that take less work.
I also don't have much rep on SuperUser, so I'm sad to say I can't really give all the links I need to in the response. I re-posted my response on Tumblr.
In summary:
- Git's bash is a part of the msysGit project.
- msysGit is a fork of the MinGW and MSYS project
- You'll need either msysGit or MinGW to install MinGW-get
- You'll need MinGW-get to install Groff
- You'll need Groff to run these scripts to give you a man command from within the msys bash shell
- With those scripts in place, you can read man pages. You'll just need to download them to the path you've indicated in the scripts.
Good luck.
I have stitched together some of the other answers to get a man
command you can use like you would natively. Just stick the following in your .bashrc
, and either source
it, or re-open your terminal.
function man {
local section=all
if [[ "$1" =~ ^[0-9]+$ ]]; then section="$1"; shift; fi
local doc="$(curl -v --silent --data-urlencode topic="$@" --data-urlencode section="$section" http://man.he.net/ 2>&1)"
local ok=$?
local pre="$(printf '%s' "$doc" | sed -ne "/<PRE>/,/<\/PRE>/ { /<PRE>/ { n; b; }; p }")"
[[ $ok -eq 0 && -n "$pre" ]] && printf '%s' "$pre" | less || printf 'Got nothing.\n' >&2
return $ok
}
It also supports requesting particular man sections, for example man 3 printf
for the system call.
Weaknesses: The source (man.he.net) isn't exactly a RESTful API, and it returns 200 even when nothing is found, so it's hard to give accurate error messages. Instead, this just prints "Got nothing", no matter what the problem was. This can probably be improved. Also, the resulting page contains html entities, such as <
instead of <
, which makes some usage strings ugly.