improve countdown script
This commit is contained in:
parent
f948900e43
commit
9ec26f97f3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue