Skip to content

Instantly share code, notes, and snippets.

@wandersick
Last active August 21, 2016 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wandersick/0ebd711e65e9b99166d31bee43e202d1 to your computer and use it in GitHub Desktop.
Save wandersick/0ebd711e65e9b99166d31bee43e202d1 to your computer and use it in GitHub Desktop.
Publish quotes as blog posts to Google Blogger using GoogleCL - Linux (Deprecated)
# Script: quotes_en.sh (deprecated)
# Version: 1.0 - 20110227
# Platform: Linux
# Databases: quotes_en_number, quotes_en.ini
# Creator: wandersick - https://wandersick.blogspot.com/2016/08/auto-posting-inspirational-quotes-on.html
# Purpose: Publish quotes as blog posts to Google Blogger using GoogleCL (Linux)
#
# Usage: Modify /root/quotes/ to a location where this script and quotes are stored.
# Change 'English Quotes' to your blog name.
# Ensure write access is permitted to quotes_en_number (generated by script on first run)
# Quotes formatted as below should be saved in a text file named quotes_en.ini. Run/schedule this script on Linux.
#
# "Hold faithfulness and sincerity as first principles."= Confucius
# "Peace cannot be kept by force. It can only be achieved by understanding."= Albert Einstein
#
# Caution: Be careful of chars like ’ (not ') in quotes that could break this script
#!/bin/sh
cd /root/quotes
if [ ! -e quotes_en_number ] ; then echo '1' > quotes_en_number ; fi
number=$( cat 'quotes_en_number' )
quote=$( cat 'quotes_en.ini' | sed -n "$number p" | sed 's/\([^=]*\)=\([^=]*\).*/\1/')
author=$( cat 'quotes_en.ini' | sed -n "$number p" | sed 's/\([^=]*\)=\([^=]*\).*/\2/')
google blogger post --blog 'English Quotes' --title "$author" --tags "$author" "<p>$quote$author</p>"
expr $number + 1 >'quotes_en_number'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment