Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created February 8, 2022 17:00
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 pmarreck/5233fbce8b5bcd2ebdf53a4c7db3c999 to your computer and use it in GitHub Desktop.
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
# 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