Created
July 7, 2014 00:41
-
-
Save takuya/5b0e2c0bb26ce79338cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if ! $( type -P groff >/dev/null); then | |
echo groff is not found. | |
echo please install groff | |
exit 1; | |
fi | |
name=$1 | |
name=$( echo $name | tr "[:upper:]" "[:lower:]") | |
path=$( man -W $name ); | |
if test "$path" != "" && [ -f $path ] ; then | |
$(groff -Tps -mandoc -c $path 2>/dev/null| ps2pdf - 2>/dev/null 1>./$name.pdf ) | |
echo printed to ./$name.pdf; | |
if [[ `uname -a` = Darwin* ]]; then | |
open ./$name.pdf | |
fi | |
exit 0 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment