blog.nek0.eu/newpost.sh

37 lines
565 B
Bash
Raw Normal View History

2018-03-30 21:23:51 +00:00
#! /bin/sh
2016-03-04 15:42:36 +00:00
date=$(date --rfc-3339=date)
title=
author=
function input {
echo "Enter post title:"
read title
echo "Enter author name:"
read author
}
function confirmation {
echo "Is the following correct?"
echo "title: $title"
echo "author: $author"
echo "y/n"
}
function main {
local conf="n"
while [ "$conf" != "y" ]
do
input
confirmation
read conf
done
2017-12-01 20:54:46 +00:00
postname="./site/posts/$date-${title// /-}.md"
2016-03-04 15:42:36 +00:00
echo -e "---\ntitle: ${title}\nauthor: ${author}\ntags: \ndescription: \n---" >> $postname
2017-04-19 03:08:54 +00:00
vim $postname
2016-03-04 15:42:36 +00:00
}
main
unset date title author