improve countdown script
This commit is contained in:
parent
f948900e43
commit
9ec26f97f3
|
@ -16,14 +16,15 @@ function init_day {
|
||||||
}
|
}
|
||||||
|
|
||||||
if init_day; then
|
if init_day; then
|
||||||
next_day=$(($day + 1))
|
next_day=$((day + 1))
|
||||||
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
|
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
|
||||||
while true; do
|
while true; do
|
||||||
secs_left=$(($next_timestamp - $(date +%s)))
|
secs_left=$((next_timestamp - $(date +%s)))
|
||||||
if [ $secs_left -le 0 ]; then
|
if [ $secs_left -le 0 ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
printf "\r\x1b[K%s secs left..." "$secs_left"
|
printf "\r\x1b[K%s secs left..." "$secs_left"
|
||||||
|
sleep 0.3
|
||||||
done
|
done
|
||||||
printf "\r\x1b[K"
|
printf "\r\x1b[K"
|
||||||
init_day
|
init_day
|
||||||
|
|
Loading…
Reference in New Issue