#!/bin/sh . bin/func set -e current_date=$(date +"%a, %d %b %Y %H:%M:%S %z") uname=$(uname) cat <<-EOF > "${rss_out_file}" <rss version="2.0"> <channel> <title>${website_title}</title> <description>${website_description}</description> <link>${website_link}</link> <copyright>$(date +"%Y") ${website_title} - All rights reserved</copyright> <managingEditor>${website_email}</managingEditor> <webMaster>${website_email}</webMaster> <lastBuildDate>${current_date}</lastBuildDate> <pubDate>${current_date}</pubDate> <generator>${website_generator}</generator> <language>${website_language}</language> <docs>https://validator.w3.org/feed/docs/rss2.html</docs> <ttl>1800</ttl> EOF for file in $(__list_files_date "${rss_dir}"); do title=$(__get_value_title "${file}") date=$(__get_value_date_publication "${file}") link="${website_link}/$(__get_final_filename ${file})" if [ "${uname}" = "Linux" ]; then guid="$(echo ${link} | sha256sum | cut -d ' ' -f 1)" else guid="$(echo ${link} | sha256)" fi cat <<-EOF >> "${rss_out_file}" <item> <title>${title}</title> <link>${link}</link> <pubDate>${date}</pubDate> <guid>${guid}</guid> </item> EOF done cat <<-EOF >> "${rss_out_file}" </channel> </rss> EOF