Fork me on GitHub

article

man Files as PDF, revisited.

May 24, 2011 | *nix, Computers

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.

  1.  #! /bin/bash
  2.  mpg=$1
  3.  if [ ! $mpg ]; then
  4.   echo "Enter a man page to convert: ";
  5.   read mpg;
  6.  fi
  7.  if [ ! $mpg ]; then
  8.   exit;
  9.  fi
  10.  man -t $mpg | open -f -a /Applications/Preview.app;
  11.  exit;

Enjoy!