So I wrote a little bash script this morning to make creating a new jekyll post easy for my blog.

array=( $@ )
len=${#array[@]}
_first=$1
_last=${array[$len-1]}
_rest=${array[@]:1:$len-2}
_filename=$( printf "%s-%s" "$(date +%F)" "$_first" )
_postname=$( printf "%s %s" "$_first" "$_rest" )

echo $_rest

for var in $_rest 
do
    _filename+="-"
    _filename+=$var
done

cat <<EOF > _posts/$_filename.md
---
layout: post
title: $_postname
comments: true
Date:   $(date +%F_%T) -05:00
categories: $_last
---
EOF

open _posts/$_filename.md 

All the arguments except the last are the name of the post and file. The last argument is the category.

It then opens it, as I’m in OS X, in mac vim. I just hit the keys ‘Go’ (heh, funny) and start editing.

I certainly could be done better, but I’m not a bash guy. This works for now and I can change it as time goes.