diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-10-05 23:20:10 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-10-05 23:20:10 +0200 |
commit | f023c7d28624c77712973ad65eb51434b35ce086 (patch) | |
tree | d85c5e8342837fce3fff92b9737586065a4eed72 | |
parent | ac4f5eab34ab8a95cd35beed498bb1d7bac854a7 (diff) | |
download | scripts-f023c7d28624c77712973ad65eb51434b35ce086.tar.gz scripts-f023c7d28624c77712973ad65eb51434b35ce086.tar.bz2 scripts-f023c7d28624c77712973ad65eb51434b35ce086.zip |
update
-rwxr-xr-x | phlogmap | 6 | ||||
-rwxr-xr-x | phlogrss | 8 | ||||
-rwxr-xr-x | phlogthis | 31 |
3 files changed, 21 insertions, 24 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/env bash # build gophermap -cd $HOME/src/gopher/phlog +cd "$HOME/src/gopher/phlog" echo "+-----------------------------------+" > gophermap echo "| Phil's Phlog |" >> gophermap @@ -12,8 +12,8 @@ echo "" >> gophermap dirs=($(ls -dr */)) for dir in "${dirs[@]}"; do - dt=$(echo $dir| cut -c 1-10) - title="$(head -n 1 $dir/gophermap)" + dt=$(echo "$dir" | cut -c 1-10) + title="$(head -n 1 "$dir/gophermap")" echo -e "1$dt $title\t/phlog/$dir\tspike.nagatha.fr\t70" >> gophermap done @@ -2,13 +2,12 @@ # create a gopher rss feed -cd $HOME/src/gopher/phlog +cd "$HOME/src/gopher/phlog" || exit phloglink="gopher://spike.nagatha.fr/1/phlog" description="Phil's Phlog" -rsslink=gopher://spike.nagatha.fr/0/phlog/rss.xml -filename=$HOME/src/gopher/phlog/rss.xml -phlogroot=$HOME/src/gopher/phlog +rsslink="gopher://spike.nagatha.fr/0/phlog/rss.xml" +filename="$HOME/src/gopher/phlog/rss.xml" builddate=$(date --iso-8601=ns) buildyear=$(date +%Y) @@ -69,7 +68,6 @@ for dir in "${dir_array[@]}"; do post="${dir//\//}" title=$(head -n1 "$post/gophermap") postdate=$(cat "$post/gophermap" | sed -n '2p') - postname=${post##*/} linkadd="$phloglink/$post" description="$(cat "$post/gophermap" | sed -n "/^$/,/^$/p" | head --lines 3) …" build_item "$post" @@ -4,27 +4,27 @@ # requires the text formating utility 'par' # editor is micro -pushd "$(pwd)" +pushd "$(pwd)" || exit -root=$HOME/src/gopher/phlog -remoteroot=/srv/gopher/phlog +root="$HOME/src/gopher/phlog" +remoteroot="/srv/gopher/phlog" -mkdir -p $HOME/.tmp -cd $HOME/.tmp || exit +mkdir -p "$HOME/.tmp" +cd "$HOME/.tmp" || exit editfile="phlogtmp.txt" articledate="$(date -R)" filedate="$(date +%Y-%m-%d-%H-%I)" article="/tmp/gophermap.tmp" -read -r -p "Enter title: " title +read -rp "Enter title: " title -filetitle=$(echo $title | sed 's/ /-/g' | sed 's/[^A-Za-z0-9._-]//g') +filetitle=$(echo "$title" | sed "s/ /-/g" | sed "s/[^A-Za-z0-9._-]//g") dirname="$filedate-$filetitle" # make local and remote dirs -mkdir $root/$dirname +mkdir "$root/$dirname" echo "creating remote directory..." -ssh spike mkdir $remoteroot/$dirname +ssh spike mkdir "$remoteroot/$dirname" # edit text micro +4:1 "$editfile" @@ -33,7 +33,7 @@ micro +4:1 "$editfile" # non-empty line doesn't contain spaces cat "$editfile" | par -jw67 > $article || cat "$editfile" > $article -header="$title\n$articledate\n+$(printf '%*s' 65 | tr ' ' '-')+\n\n" +header="$title\n$articledate\n+$(printf "%*s" 65 | tr " " "-")+\n\n" sed -i "1s/^/$header/" $article dest="$root/$dirname/gophermap" @@ -41,23 +41,22 @@ mv "$article" "$dest" rm $editfile clear -cat $dest +cat "$dest" echo " " -read -p "Do you want to edit this text? : " choix1 +read -rp "Do you want to edit this text? : " choix1 if [ "$choix1" != "n" ] ; then clear - micro $dest + micro "$dest" fi echo "Article saved as $dest" -read -p "Run phlogmap & phlogrss & gosend? ; " choix2 +read -rp "Run phlogmap & phlogrss & gosend? ; " choix2 if [ "$choix2" != "n" ] ; then phlogmap; phlogrss ; gosend fi -popd -exit 0 +popd || exit |