You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
489 B
18 lines
489 B
#!/bin/bash
|
|
if [[ -z "$@" ]]; then
|
|
echo "add.sh <title>"
|
|
exit 1
|
|
fi
|
|
title="$@"
|
|
clean_title=$(echo $title | tr ' ' '_' | tr '[:upper:]' '[:lower:]')
|
|
filename="content/$clean_title"
|
|
if [[ -e $filename.md ]]; then
|
|
echo "$filename.md already exists"
|
|
exit 1
|
|
fi
|
|
echo "Title: $title" >> $filename.md
|
|
echo "Date: $(date -Iminutes)" >> $filename.md
|
|
echo "Author: Wxcafé" >> $filename.md
|
|
echo "Slug: $clean_title" >> $filename.md
|
|
echo -e '\n'>> $filename.md
|
|
vim +7 $filename.md -s <( echo -n A)
|
|
|