sky-y
12/21/2015 - 1:02 AM

Send a EPUB file to Kindle (it needs kindlegen, postfix and mutt)

Send a EPUB file to Kindle (it needs kindlegen, postfix and mutt)

#!/bin/bash

file_epub=$1
file_mobi=${file_epub%epub}mobi
my_email="myname@kindle.com"

if [ $# -ne 1 ]; then
  echo "Usage: epub2kindle foo.epub" 1>&2
  exit 1
fi

case "$file_epub" in
*\.epub)
 # do nothing
 ;;
*)
 echo "Error: Use .epub file."
  exit 1
 ;;
esac

kindlegen $file_epub && mutt -s \"\" -a $file_mobi -- $my_email < /dev/null