Skip to content

Instantly share code, notes, and snippets.

@jandahl
Last active June 24, 2016 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jandahl/d35ea8bc30daee59632f0cf1bd3ab35d to your computer and use it in GitHub Desktop.
Save jandahl/d35ea8bc30daee59632f0cf1bd3ab35d to your computer and use it in GitHub Desktop.
#!/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