Yesterday I wrote about my blogging software which consists of a few shell scripts
and some m4 macros. Today I will show you one of the most important scripts from
this blogging toolkit: makepost.sh.
#! /usr/bin/env bash
set -x
ITEM="$*"
FILEINFO=$(echo $ITEM | tr " " "_")
FILENAME=$(date +"%Y-%m-%d-%H-%M_$FILEINFO.m4")
sed "s/_TITLE_/$ITEM/" entry.m4 > $FILENAME
svn add $FILENAME
svn propset svn:keywords Id $FILENAME
vim $FILENAME
What it does is simple. It generates the filename to use for this blog
post, based on the date, time and title. Copies the posting template to
the blog post file, while setting the title correct. It adds the post to
the subversion repos and starts vim to edit the file. After that I only have to
start writing.