#!/usr/bin/env bash ### TEMPSUFFIX="$(od -t x1 -An -N6 /dev/urandom | tr -d '\n ')" TEMPFILE="/tmp/rss.xml.${TEMPSUFFIX}" # Make a tempfile for rss feed construction touch "${TEMPFILE}" echo "Tempfile at: ${TEMPFILE}" ### title='Glue Code' link="https://gluecode.net/blog" description='Brain Dump' rsslink="https://gluecode.net/blog/rss.xml" feedname="/var/www/blog/rss.xml" postDir="/var/www/blog/posts" ### header=""" ${title} ${link} ${description} """ footer="" echo $header >> $TEMPFILE postArray=( $(ls -r "$postDir"/*/*.html) ) numPosts=$(ls "$postDir"/*/*.html | wc -l) echo "numposts is $numPosts" for posts in "${postArray[@]}"; do post=$posts fullTitle=$(grep -o '>.*' $post | sed -e 's,>,,g' -e 's, $fullTitle $linkadd $linkadd $fulltitle $extract """ >> $TEMPFILE done echo $footer >> $TEMPFILE mv -v $TEMPFILE $feedname