#!/bin/bash file_path="$HOME/.scripts/buskill" failed_path="$file_path/.failed" countdown_path="$file_path/countdown.template" last_status_path="$file_path/.last_status" days_missed=$(<"$failed_path") if [ "$days_missed" = "" ]; then days_missed=0 fi echo "Days Missed: $days_missed" if [ "$days_missed" -gt 0 ]; then status_content="$(sed "s/%days%/$days_missed/" < "$countdown_path")" toot_output="$(toot post "$status_content")" status_id="$(echo "$toot_output" | awk -F '/' '{print $6}')" let days_missed++ echo "$days_missed" > "$failed_path" echo "$status_id" > "$last_status_path" else echo 1 > "$failed_path" echo > "$last_status_path" fi