#! /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 > /tmp/t1$$ echo ..done troff cat /tmp/t1$$ | dpost > /tmp/t2$$ echo ..done dpost ps2pdf /tmp/t2$$ $HOME/$filename.pdf echo ..done ps2pdf echo "the pdf file is:" ls -lt $HOME/$filename.pdf rm /tmp/t1$$ /tmp/t2$$ echo DONE