aboutsummaryrefslogtreecommitdiffstats
path: root/aaoth_new_post.sh
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2021-06-02 23:57:59 +0300
committerla-ninpre <leobrekalini@gmail.com>2021-06-02 23:57:59 +0300
commitfad51a988ca2896681e03bb5367501135ed62088 (patch)
tree71aae7b8163eb9d606cbb08d094f318c10456854 /aaoth_new_post.sh
parent4b40cbc0dddda0c92094e8435fb144d9d071ae5e (diff)
downloadaaoth.xyz-fad51a988ca2896681e03bb5367501135ed62088.tar.gz
aaoth.xyz-fad51a988ca2896681e03bb5367501135ed62088.zip
rename pgp key file to just pgp and fix shellcheck complaints
Diffstat (limited to 'aaoth_new_post.sh')
-rwxr-xr-xaaoth_new_post.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/aaoth_new_post.sh b/aaoth_new_post.sh
index 3ca34b4..8c2139f 100755
--- a/aaoth_new_post.sh
+++ b/aaoth_new_post.sh
@@ -24,13 +24,13 @@ usage() {
}
read_title() {
- echo -n "new post title: "
- read TITLE
+ echo "new post title: "
+ read -r TITLE
}
read_tags() {
- echo -n "new post tags: "
- read TAGS
+ echo "new post tags: "
+ read -r TAGS
}
create_tag_page() {
@@ -44,7 +44,7 @@ permalink: /tags/$1/
TAG
}
-cd $SITE_DIR
+cd "$SITE_DIR" || exit 1
# if there are no arguments specified, run interactively
if [ $# -gt 0 ]
@@ -79,7 +79,7 @@ fi
[ -z "$TAGS" ] && read_tags
[ -z "$TAGS" ] && echo "specify at least one tag" && exit 1
-TITLE_FILE=$(echo $TITLE | tr '[A-Z]' '[a-z]' | sed 's/ /-/g')
+TITLE_FILE=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')
POST_FILENAME="$POSTS_DIR/$DATE_SHORT-$TITLE_FILE.md"
@@ -87,7 +87,7 @@ for _tag in $TAGS
do
[ ! -f "./tags/$_tag.md" ] \
&& echo "tag $_tag is not present, creating one" \
- && create_tag_page $_tag
+ && create_tag_page "$_tag"
done
# template is currently hardcoded
@@ -103,4 +103,4 @@ tags: $TAGS
EOF
-nvim -c "normal 6jo" -c "startinsert" $POST_FILENAME
+nvim -c "normal 6jo" -c "startinsert" "$POST_FILENAME"