Skip to content

Instantly share code, notes, and snippets.

@shmup
Forked from lkptrzk/man.sh
Last active March 18, 2016 12:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmup/ca1ddb6125100e8f44e0 to your computer and use it in GitHub Desktop.
Save shmup/ca1ddb6125100e8f44e0 to your computer and use it in GitHub Desktop.
`man` replacement for git bash on windows
#!/bin/sh
# man - `man` replacement for git bash on windows
# Requires:
# Git Bash - https://git-scm.com/downloads/
# wget - https://eternallybored.org/misc/wget/
# Notes:
# `sed -r` = allows gnu regex extensions (like +)
# `wget -qO -` = non-verbose output, returned file to stdout instead of file
if [ $# -eq 0 ] ; then
echo "No command specified to get man page for"
exit 1
fi
url="http://man.he.net/?section=all&topic="
# The extra `+` at the end of the querystring doesn't hurt
for arg in $@ ; do
url=$url$arg"+"
done
# piped into sed to remove html tags
wget -qO - $url | sed 's/<[^>]*>//g' | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment