man Files as PDF, revisited.

I’ve posted before on converting man files to PDF for easier reading and forgot to post this update. The code is much terser, reminds you when you’ve invoked it without a parameter, and doesn’t leave turds that it has to clean up.

#! /bin/bash
mpg=$1

if [ ! $mpg ]; then
	echo "Enter a man page to convert: ";
	read mpg;
fi

if [ ! $mpg ]; then
	exit;
fi

man -t $mpg | open -f -a /Applications/Preview.app;

Enjoy!

Tagged as: *nix pdf man help script