Skip to content

Instantly share code, notes, and snippets.

@joeybaumgartner
Last active December 21, 2023 06:23
Show Gist options
  • Select an option

  • Save joeybaumgartner/f3675fc2861ca3e47c8ccc29bdfc306e to your computer and use it in GitHub Desktop.

Select an option

Save joeybaumgartner/f3675fc2861ca3e47c8ccc29bdfc306e to your computer and use it in GitHub Desktop.

Revisions

  1. joeybaumgartner revised this gist Nov 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion man2pdf.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ fi
    tempfoo=`basename $0`
    TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1

    man -t $1 | pstopdf -o $TMPPDFFILE
    man -t $* | pstopdf -o $TMPPDFFILE

    export psStatus=$?
    if [ $psStatus -ne 0 ]; then
  2. joeybaumgartner revised this gist Nov 16, 2022. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions man2pdf.sh
    Original file line number Diff line number Diff line change
    @@ -7,17 +7,14 @@ then
    fi

    tempfoo=`basename $0`
    TMPPSFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
    echo "program output" >> $TMPPSFILE
    TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1

    man -t $1 | pstopdf -o $TMPPDFFILE

    man -t $1 > $TMPPSFILE
    export psStatus=$?
    if [ $psStatus -ne 0 ]; then
    echo "Could not output contents of man page to temp file"
    exit 1
    fi

    TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
    pstopdf $TMPPSFILE -o $TMPPDFFILE

    open -a Preview.app $TMPPDFFILE
    open -a Preview.app $TMPPDFFILE
  3. joeybaumgartner revised this gist Nov 16, 2022. No changes.
  4. joeybaumgartner created this gist Nov 16, 2022.
    23 changes: 23 additions & 0 deletions man2pdf.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/sh

    if [ $# -lt 1 ]
    then
    echo “man2pdf [man page name]”
    exit
    fi

    tempfoo=`basename $0`
    TMPPSFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
    echo "program output" >> $TMPPSFILE

    man -t $1 > $TMPPSFILE
    export psStatus=$?
    if [ $psStatus -ne 0 ]; then
    echo "Could not output contents of man page to temp file"
    exit 1
    fi

    TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
    pstopdf $TMPPSFILE -o $TMPPDFFILE

    open -a Preview.app $TMPPDFFILE