Last active
December 21, 2023 06:23
-
-
Save joeybaumgartner/f3675fc2861ca3e47c8ccc29bdfc306e to your computer and use it in GitHub Desktop.
Script for opening PDF documents in Preview on macOS Ventura and newer.
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
#!/bin/sh | |
if [ $# -lt 1 ] | |
then | |
echo “man2pdf [man page name]” | |
exit | |
fi | |
tempfoo=`basename $0` | |
TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1 | |
man -t $* | pstopdf -o $TMPPDFFILE | |
export psStatus=$? | |
if [ $psStatus -ne 0 ]; then | |
echo "Could not output contents of man page to temp file" | |
exit 1 | |
fi | |
open -a Preview.app $TMPPDFFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made an edit based on this comment from a reddit thread so that you can specify the man section you're interested in.