Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Last active May 13, 2022 23:46
Show Gist options
  • Save kristopherjohnson/2983879 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/2983879 to your computer and use it in GitHub Desktop.
Display man page as HTML
#!/bin/bash
# Displays man page as HTML page
#
# Requires the man2html utility, which can be installed on OS X with Homebrew (brew install man2html)
# See http://dcssrv1.oit.uci.edu/indiv/ehood/man2html.html for more info.
if [ -z "$1" ]; then
echo "usage: hman MANPAGE"
exit 1
fi
mkdir -p "$TMPDIR/hman"
tmp_file="$TMPDIR/hman/$1.html"
man $1 | man2html > "$tmp_file"
open "$tmp_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment