Unverified Commit 9272d5cd authored by Philip Kaludercic's avatar Philip Kaludercic 🌝
Browse files

added script to quickly create new posts

parent 6e0b18bc
#!/bin/sh
if [ $# -lt 1 ]
then
echo "usage: $0 title" >&2
exit 1
fi
FNAME=posts/$(echo "$@" | sed 's/[[:space:]]+/_/g' | tr '[:upper:]' '[:lower:]').md
if [ -f "$FNAME" ]
then
echo "post (\"$FNAME\") already exists" >&2
exit 1
fi
cat > "$FNAME" <<EOF
title: $@
date: $(date +"%Y-%m-%d %H:%M")
author: $(getent passwd "$USER" | cut -d: -f5 | cut -d, -f1)
tags: news
---
EOF
exec "${EDITOR:-vi}" "$FNAME"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment