Script to generate new post for writing and quote template
This commit is contained in:
23
scripts/new-post.sh
Executable file
23
scripts/new-post.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Change to blog folder
|
||||
cd ../blog
|
||||
|
||||
# Get number of posts
|
||||
POSTNUM=$( ls -l content-* | wc -l )
|
||||
QUOTENUM=$( ls -l quote-* | wc -l )
|
||||
if [[ $POSTNUM -gt $QUOTENUM ]];then
|
||||
CURRNUM=$POSTNUM
|
||||
else
|
||||
CURRNUM=$QUOTENUM
|
||||
fi
|
||||
|
||||
# Create post and quote from template
|
||||
NEWPOSTNAME="content-$(printf %03d "$CURRNUM")"
|
||||
NEWQUOTENAME="quote-$(printf %03d "$CURRNUM")"
|
||||
cp .blog.template "$NEWPOSTNAME"
|
||||
cp .quote.template "$NEWQUOTENAME"
|
||||
|
||||
# Show new file names
|
||||
echo "$NEWPOSTNAME"
|
||||
echo "$NEWQUOTENAME"
|
Reference in New Issue
Block a user