Skip to content

Instantly share code, notes, and snippets.

@atn34
Created April 4, 2014 03:21
Show Gist options
  • Save atn34/9967417 to your computer and use it in GitHub Desktop.
Save atn34/9967417 to your computer and use it in GitHub Desktop.
#! /bin/sh
usage() {
echo "usage: $0 <title>"
}
if [ $# -eq 0 ] ; then
usage
exit 1
fi
TITLE="$@"
DATE=$(date +"%Y-%m-%d")
OUTPUTDIR="_posts"
OUTFILE="$OUTPUTDIR/$DATE-$(echo $TITLE | sed 's/ /-/g').markdown"
cat > "$OUTFILE" << EOF
---
layout: post
title: "$TITLE"
date: $DATE $(date +"%T")
categories: TODO
---
# TODO #
EOF
vim "$OUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment