From 9ec26f97f3b3811ea836a5203b4e81972d64bd3c Mon Sep 17 00:00:00 2001 From: haskal Date: Thu, 3 Dec 2020 01:14:43 -0500 Subject: [PATCH] improve countdown script --- scripts/countdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/countdown b/scripts/countdown index 513e3bc..e1c993c 100755 --- a/scripts/countdown +++ b/scripts/countdown @@ -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