Skip to content

Instantly share code, notes, and snippets.

@kaorimatz
Created February 8, 2013 09:00
Show Gist options
  • Save kaorimatz/4737557 to your computer and use it in GitHub Desktop.
Save kaorimatz/4737557 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ $# -lt 1 ]; then
echo "usage: $0 [PAGE]"
exit 1
fi
OUTFILE=`mktemp`
BROWSER=firefox
PAGE=$1
PAGE_PATH=`man -w $PAGE 2> /dev/null`
if [ -z "$PAGE_PATH" ]; then
exit 1
fi
CAT='cat'
if [ "${PAGE_PATH##*.}" == "gz" ]; then
CAT='zcat'
fi
$CAT $PAGE_PATH | troff -mmandoc -Thtml | post-grohtml -l -r > $OUTFILE
$BROWSER $OUTFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment