Link now selected from a dynamic menu

This commit is contained in:
2025-07-05 11:20:33 -04:00
parent 63641ab046
commit 3312b77ffe

37
rss.sh
View File

@ -2,19 +2,42 @@
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
DATE="$(date -R)"
source "${BASEDIR}/website.conf" source "${BASEDIR}/website.conf"
shopt -s extglob
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
DATE="$(date -R)"
LINKS=($(find -P "${WEBROOT}/blog/" | grep 'index\.html' | grep -v 'blog/index\.html' | sed 's|index.html||g; s|.*/blog|blog|g' | sort))
MENU="@(${LINKS[0]}"
for ((i=1;i<${#LINKS[@]};i++)); do
MENU+="|${LINKS[${i}]}"
done
MENU+=")"
printf 'Select the link you wish to use\n'
select LINK in "${LINKS[@]}"
do
case ${LINK} in
${MENU})
break
;;
*)
printf \
'Invalid option\n'
;;
esac
done
printf 'Title of blog post:\n' printf 'Title of blog post:\n'
read -r TITLE read -r TITLE
printf 'Link to blog post:\n'
read -r LINK
LINK="$(printf "${LINK}" | sed 's|^/||')"
printf 'Description of blog post:\n' printf 'Description of blog post:\n'
read -r DESCRIPTION read -r DESCRIPTION