#! /bin/sh if test $# -eq 0 then echo "usage man-to-pdf " echo "e.g., man-to-pdf touch" exit fi if whereis $1 | grep man > /dev/null then filepath=` whereis $1 | tr ' ' '\n' | grep man | head -1 ` filename=` basename $filepath` else echo "man page for $1 is not found" exit fi troff -man $filepath | dpost | ps2pdf - $HOME/$filename.pdf echo "the pdf file is:" ls -lt $HOME/$filename.pdf echo DONE