Last Updated: January 28, 2019
·
1.271K
· quekshuy

[Shell] Quickly post something to Octopress

I want to quickly be able to post some quick thoughts to Octopress (just like I would like to with Coderwall actually), so I wrote a quick shell script to allow me to do that.

The script is in ~/bin which is on $PATH.

To blog, I just need to do this:

# title of the post in quotes
$ blog "This is a new post"  

The script is here:

#! /bin/bash

BLOG_DIR=~/Dropbox/Projects/octopress
cd $BLOG_DIR
NEW_POST_PATH=`rake new_post["$1"] | awk '/Creating new post:/ {print $4}'`
echo "Editing blog entry $BLOG_DIR/$NEW_POST_PATH"
sleep 1
vim $BLOG_DIR/$NEW_POST_PATH
rake generate
git add .
git commit -m"$1"
git push origin source
rake deploy