Created
January 2, 2012 13:26
-
-
Save peio/1550675 to your computer and use it in GitHub Desktop.
Convert and email a markdown file to my Kindle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Convert and email MarkDown file to Kindle | |
MD_FILE=$1 | |
HTML_FILE=`basename "$MD_FILE" .md` | |
HTML_FILE='/tmp/'$HTML_FILE".html" | |
KINDLE_HEADER='/home/peio/bin/kindle.header' | |
# Create header | |
cat $KINDLE_HEADER > "$HTML_FILE" | |
# Markdown to content | |
/usr/bin/markdown -x toc -x def_list -x footnotes -e utf-8 "$MD_FILE" >> "$HTML_FILE" | |
# Footer | |
echo '</body></html>' >> "$HTML_FILE" | |
echo "Send file" | mailx -s "Reads" -a "$HTML_FILE" peio@kindle.com | |
echo $HTML_FILE" sent" | |
rm "$HTML_FILE" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment