Created
February 8, 2022 17:00
-
-
Save pmarreck/5233fbce8b5bcd2ebdf53a4c7db3c999 to your computer and use it in GitHub Desktop.
Shell function(s) to get a pretty man page viewed as a PDF up in a PDF viewer on (any?) Linux distro
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
# helper function | |
needs () { | |
local bin=$1; | |
shift; | |
command -v $bin > /dev/null 2>&1 || { | |
echo "I require $bin but it's not installed or in PATH; $*" 1>&2; | |
return 1 | |
} | |
} | |
pman () { | |
needs evince provided by evince package; # instructions may depend on distro | |
tmpfile=$(mktemp --suffix=.pdf /tmp/$1.XXXXXX); | |
man -Tpdf "$@" >> $tmpfile 2>/dev/null; | |
evince $tmpfile & | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment