Skip to content

Instantly share code, notes, and snippets.

@wb14123
Created January 31, 2013 12:31
Show Gist options
  • Save wb14123/4682546 to your computer and use it in GitHub Desktop.
Save wb14123/4682546 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "newpost: You need to specify the post name."
exit 1
fi
POST_NAME=$1
POST_DATE=`date +%Y-%m-%d`
POST_DIR="./jekyll/_posts"
FILE_NAME=`echo "$POST_DIR/$POST_DATE-$POST_NAME.markdown" | sed "s/ /-/g"`
echo "
---
layout: post
title: $POST_NAME
tags: []
---
" > $FILE_NAME
vim -c "set spell" $FILE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment