about summary refs log tree commit diff
path: root/newpost.sh
diff options
context:
space:
mode:
authorHuy-Ngo <duchuy29092000@gmail.com>2021-01-11 16:52:22 +0700
committerHuy-Ngo <duchuy29092000@gmail.com>2021-01-11 16:52:22 +0700
commitdd514ff1971b57c7f3e7922d3beefd244017627a (patch)
treeb1c679f956a18714dbf298e72ac1fdbb26a11ff9 /newpost.sh
parent2f3dbffd713b0fda91696b147a8f2e739faf8e0a (diff)
downloadblog-dd514ff1971b57c7f3e7922d3beefd244017627a.tar.gz
Fix the newpost script
Diffstat (limited to 'newpost.sh')
-rwxr-xr-xnewpost.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/newpost.sh b/newpost.sh
index 7918999..d689221 100755
--- a/newpost.sh
+++ b/newpost.sh
@@ -5,12 +5,13 @@ read tags
 printf "Categories: "
 read categories
 name="_posts/$(date -I)-${title,,}"
-name=${name/ /-}.md
+name=${name// /-}.md
 _date=$(date "+%Y-%m-%d %T %z")
-echo "---" >> $name
-echo "layout: post" >> $name
-echo "title:  \"$title\"" >> $name
-echo "date:   $_date" >> $name
-echo "tags:   $tags" >> $name
-echo "categories: $categories" >>$name
-echo "---" >> $name
+echo $name
+echo "---" > "$name"
+echo "layout: post" >> "$name"
+echo "title:  \"$title\"" >> "$name"
+echo "date:   $_date" >> "$name"
+echo "tags:   $tags" >> "$name"
+echo "categories: $categories" >>"$name"
+echo "---" >> "$name"