Skip to content

Instantly share code, notes, and snippets.

@f110
Created February 9, 2013 17:10
Show Gist options
  • Save f110/4746105 to your computer and use it in GitHub Desktop.
Save f110/4746105 to your computer and use it in GitHub Desktop.
man2epub
#!/bin/bash
set -e
FILE=`man -w $1`
command=`echo $FILE | sed -e "s/.*\/\(.*\)\..*$/\1/"`
TMP_FILE=/tmp/for-epub-$command.html
EPUB_FILE=`pwd`/$command.epub
man $command | man2html > $TMP_FILE
/Applications/calibre.app/Contents/MacOS/ebook-convert $TMP_FILE $EPUB_FILE --no-default-epub-cover --title "$command" --language "en" --dont-split-on-page-breaks
rm -f $TMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment