Last active
June 24, 2016 11:06
-
-
Save jandahl/d35ea8bc30daee59632f0cf1bd3ab35d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
function aboutMe { | |
echo -e "\n\t$scriptName, v $scriptVersion" | |
echo -e "\n\tExamples:" | |
echo -e "\n\t$scriptFile \033[1;31mcurl\033[1;0m" | |
echo -e "\t$scriptFile \033[1;31msnmpdelta\033[1;0m\n" | |
echo -e "\n\tGenerates a rich text man page for you and opens it in Preview" | |
} | |
scriptFile=$(basename "$0") | |
scriptName="PDFmanPager" | |
scriptVersion="2016-06-24 JAGR" | |
if [ "$#" -lt 1 ]; then | |
aboutMe; | |
exit | |
fi | |
if man "$1" > /dev/null 2>&1 | |
then | |
man -t "$1" | ps2pdf - - | open -f -a Preview | |
else | |
echo -e "No man page found for \033[1;31m$1\033[1;0m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment