improve countdown script

This commit is contained in:
xenia 2020-12-03 01:14:43 -05:00
parent f948900e43
commit 9ec26f97f3
1 changed files with 3 additions and 2 deletions

View File

@ -16,14 +16,15 @@ function init_day {
}
if init_day; then
next_day=$(($day + 1))
next_day=$((day + 1))
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
while true; do
secs_left=$(($next_timestamp - $(date +%s)))
secs_left=$((next_timestamp - $(date +%s)))
if [ $secs_left -le 0 ]; then
break
fi
printf "\r\x1b[K%s secs left..." "$secs_left"
sleep 0.3
done
printf "\r\x1b[K"
init_day