Skip to content

Instantly share code, notes, and snippets.

@sky-y
Created December 21, 2015 01:02
Show Gist options
  • Save sky-y/69282e06d28c3c4099ea to your computer and use it in GitHub Desktop.
Save sky-y/69282e06d28c3c4099ea to your computer and use it in GitHub Desktop.
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="[email protected]"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment