jeroen.se
by jnieuwen
Posting to my blog with makepost.sh
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.
0 comments

Nick:
Email:
Make your own addition with integers (needed to make sure you aint a spambot):
+ =
Categories
Cycling (2)
Gadgets (3)
Misc (22)
Scripting (23)
Travel (7)
Unix (24)
Archive
April 2010 (2)
January 2010 (1)
December 2009 (1)
November 2009 (2)
May 2009 (1)
April 2009 (1)
March 2009 (1)
February 2009 (7)
January 2009 (3)
December 2008 (1)
November 2008 (4)
October 2008 (5)
September 2008 (1)
August 2008 (3)
July 2008 (2)
June 2008 (2)
May 2008 (3)
April 2008 (1)
March 2008 (1)
February 2008 (1)
January 2008 (4)
December 2007 (1)
November 2007 (7)
October 2007 (4)
September 2007 (1)
August 2007 (2)
June 2007 (6)
May 2007 (8)