aboutsummaryrefslogtreecommitdiff
path: root/blogthis
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-08 22:42:51 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-08 22:42:51 +0200
commitcc46e89290e766ba442bc08ccfa0c71e0f873793 (patch)
tree3b2ec84ed3dcf5a8ded9db2e52b58747bf30dbd0 /blogthis
parent43f1bb6b8b2c80a68d332fb887a35b10d89a626e (diff)
downloadblog-cc46e89290e766ba442bc08ccfa0c71e0f873793.tar.gz
blog-cc46e89290e766ba442bc08ccfa0c71e0f873793.tar.bz2
blog-cc46e89290e766ba442bc08ccfa0c71e0f873793.zip
update
Diffstat (limited to 'blogthis')
-rwxr-xr-xblogthis22
1 files changed, 11 insertions, 11 deletions
diff --git a/blogthis b/blogthis
index c736c8f..9ad0e72 100755
--- a/blogthis
+++ b/blogthis
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# create text, assemble html file, add to articles
@@ -6,23 +6,23 @@
ROOT=/home/philip/web
mkdir -p $ROOT/.tmp
-cd $ROOT/.tmp
+cd $ROOT/.tmp || exit
EDITFILE="middle.html"
DATE=$(date +%Y-%m-%d)
-read -p "Enter title: " TITLE
-read -e -i "$DATE" -p "Enter date: " input
-read -p "Enter description: " DESCRIPTION
+read -r -p "Enter title: " TITLE
+read -r -e -i "$DATE" -p "Enter date: " input
+read -r -p "Enter description: " DESCRIPTION
ARTICLEDATE="${input:-$DATE}"
-YEAR=$(echo $ARTICLEDATE | cut -c 1-4)
+YEAR=$(echo "$ARTICLEDATE" | cut -c 1-4)
DEST="$ROOT/articles/$YEAR"
echo "<h2>$TITLE</h2>" > $EDITFILE
echo "<h5>$ARTICLEDATE</h5>" >> $EDITFILE
echo "<h4>$DESCRIPTION</h4>" >> $EDITFILE
-micro +4:1 $EDITFILE
+micro +4:1 "$EDITFILE"
FIXEDTITLE=${TITLE// /-}
ARTICLE="$FIXEDTITLE.html"
@@ -41,13 +41,13 @@ echo "<!doctype html>
<a href=\"/index.php\">Back</a>
<hr>
</header>
- <!-- article start -->" > $ARTICLE
-cat $EDITFILE >> $ARTICLE
+ <!-- article start -->" > "$ARTICLE"
+cat "$EDITFILE" >> "$ARTICLE"
echo '<!-- article end -->
<p>&nbsp;</p>
<hr>
<p>ยง</p>
</body>
-</html>' >> $ARTICLE
-mv $ARTICLE $DEST
+</html>' >> "$ARTICLE"
+mv "$ARTICLE" "$DEST"
echo "saved as $DEST/$ARTICLE"