#! /bin/sh if test $# -eq 0 then echo "usage mantopdf " echo "e.g., mantopdf touch" echo "e.g., mantopdf pdftotext.1" echo "e.g., mantopdf /usr/man/man1b/touch.1b" exit fi if test -f $1 then filepath=$1 else filepath=` whereis $1 | tr ' ' '\n' | grep man | head -1 ` if test -z "`echo $filepath`" then echo "man page for $1 is not found" exit fi fi filename=`path2file $filepath` echo file path is: ls -lt $filepath echo file name is: echo $filename 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