diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-08 22:42:51 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-08 22:42:51 +0200 |
commit | cc46e89290e766ba442bc08ccfa0c71e0f873793 (patch) | |
tree | 3b2ec84ed3dcf5a8ded9db2e52b58747bf30dbd0 /blogthis | |
parent | 43f1bb6b8b2c80a68d332fb887a35b10d89a626e (diff) | |
download | blog-cc46e89290e766ba442bc08ccfa0c71e0f873793.tar.gz blog-cc46e89290e766ba442bc08ccfa0c71e0f873793.tar.bz2 blog-cc46e89290e766ba442bc08ccfa0c71e0f873793.zip |
update
Diffstat (limited to 'blogthis')
-rwxr-xr-x | blogthis | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -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> </p> <hr> <p>ยง</p> </body> -</html>' >> $ARTICLE -mv $ARTICLE $DEST +</html>' >> "$ARTICLE" +mv "$ARTICLE" "$DEST" echo "saved as $DEST/$ARTICLE" |