#!/bin/sh -e date=$(date +%Y%m%d)a date2=$(date +%d/%m/%Y) date3=$(date '+%a, %d %h %Y') index=$(printf %d '"a') while [ -f "$date" ]; do index=$((index + 1)) date=${date%%?}$(printf %b "$(printf \\x%x "$index")") done cat > "$date.txt" <https://k1sslinux.org/blog/$date/ $date3 00:00:00 +0000 " entry="- $date2: $1" while read -r line; do printf '%s\n' "$line" case $line in *' blog.xml.new mv -f blog.xml.new blog.xml while read -r line; do [ "$yup" ] || case $line in -*) printf '%s\n' "$entry"; yup=1; esac printf '%s\n' "$line" done < ../blog.txt > ../blog.txt.new mv -f ../blog.txt.new ../blog.txt