Setting up a bash command to post on jekyll based blog


It is very time-consuming to write up the HEADLINE of your each post. This article is aiming to show you a bash command based way to set up the HEADLINE in the post.

#!/bin/bash
## ~/bin/wa
hppath="~/u2/www/homepage"
d=`date '+%Y-%m-%d'`
t=`date '+%b %d, %Y %H:%M:%S'`
filename=${1// /_}
head="---\n"
cd ~/u2/www/homepage/_posts/
postpath="~/u2/www/homepage/_posts"
# touch $d"-"$filename".md"`
echo -e "$head" > "$d"-"$filename".md
vim "$d"-"$filename".md

Add execute permission on this file:

chmod +x ~/bin/wa

Usage:

wa "your article title"
苏命
苏命
副研究员

我的研究方向:水源地水质安全保障,主要针对水源地由于藻类爆发引起的水体嗅味问题开展研究。