tags:

views:

50

answers:

1

I would like to load some man pages onto my iPad in PDF format.

I have very quickly put this together:

#!/bin/bash
output_directory="/Users/Shared/Local/Media/E-Books/Man_Pages/Mac_OS_X"
man_pages_directory=/usr/share/man
for man_pages_section in "${man_pages_directory}/man"?; do
  for man_page_path in "${man_pages_section}/"*; do
    man_page_file="$(basename ${man_page_path})"
    man_page_name="${man_page_file%%.*}"
    echo Processing man page: ${man_page_name}
    output_path="${output_directory}/${man_page_name}.pdf"
    if [ -e "${output_path}" ]; then
      echo ... already generated.
    else
      man -t "${man_page_name}" \
        | ps2pdf - "${output_path}"
      echo ... done @ ${output_path}
    fi
    echo
  done
done

As I was typing... I thought: there must be an elegant way to do this, I don't need to hack away... I'll just ask StackOverflow.

Maybe something that already groups C lib functions, other scripting languages, standard commands, etc, keeps a localised man page around (language: Italian) and handles duplicates gracefully?

A: 

Maybe this is a starting point (on Mac OS X):

pman -- create, print, save, view PDF man pages

http://snippets.dzone.com/posts/show/4274

caruso
This does not do what I asked... did you read the code? (mine or pman's)
Maroloccio