#!/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/news/$date/ $date3 00:00:00 +0000 " entry="- $date2: $1" while read -r line; do printf '%s\n' "$line" case $line in *' news.xml.new mv -f news.xml.new news.xml while read -r line; do [ "$yup" ] || case $line in -*) printf '%s\n' "$entry"; yup=1; esac printf '%s\n' "$line" done < ../news.txt > ../news.txt.new mv -f ../news.txt.new ../news.txt