2016-09-26 15:40:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
m=${1}
|
|
|
|
|
|
|
|
Floor () {
|
2016-10-06 03:21:13 +02:00
|
|
|
DIVIDEND=${1}
|
|
|
|
DIVISOR=${2}
|
|
|
|
RESULT=$(( ( ${DIVIDEND} - ( ${DIVIDEND} % ${DIVISOR}) )/${DIVISOR} ))
|
|
|
|
echo ${RESULT}
|
2016-09-26 15:40:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Timecount(){
|
2016-10-06 03:21:13 +02:00
|
|
|
s=${1}
|
|
|
|
HOUR=$( Floor ${s} 60/60 )
|
|
|
|
s=$((${s}-(60*60*${HOUR})))
|
|
|
|
MIN=$( Floor ${s} 60 )
|
|
|
|
SEC=$((${s}-60*${MIN}))
|
|
|
|
while [ $HOUR -ge 0 ]; do
|
|
|
|
while [ $MIN -ge 0 ]; do
|
|
|
|
while [ $SEC -ge 0 ]; do
|
|
|
|
printf "%02d:%02d:%02d\033[0K\r" $HOUR $MIN $SEC
|
|
|
|
SEC=$((SEC-1))
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
SEC=59
|
|
|
|
MIN=$((MIN-1))
|
|
|
|
done
|
|
|
|
MIN=59
|
|
|
|
HOUR=$((HOUR-1))
|
|
|
|
done
|
2016-09-26 15:40:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Timecount $m
|