# check for explicit feed link page_ext=`echo "$content" | grep -Po '(?<=)' | head -1 | tr '\0' '\n'` page_ext=${page_ext##*href=\"} # if explicit feed link not found (article, not author page), truncate post URL to get author URL if [[ "$page_ext" == "" ]] then # check for invalid link that cannot be shortened # I don't think this is necessary, but just in case if [[ "${url:0:8}" != "https://" && "${url:0:7}" != "http://" ]] && [[ "${url%%/}" == */* ]] || [[ "${url%%/}" == http*://*/* ]] then # truncate tailing slash (if applicable) rss=${url%%/} # truncate last item rss=${rss%/*} # add /feed/ page_ext=${rss}/feed/ fi fi