super simple timer
This commit is contained in:
18
reporting/timer
Executable file
18
reporting/timer
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
function displaytime {
|
||||
local T=$1
|
||||
local D=$((T/60/60/24))
|
||||
local H=$((T/60/60%24))
|
||||
local M=$((T/60%60))
|
||||
local S=$((T%60))
|
||||
printf '\r%s[' $PREFIX
|
||||
(( $D > 0 )) && printf '%dd ' $D
|
||||
(( $T > 3599 )) && printf '%02d:' $H
|
||||
printf '%02d:%02d]%s\r' $M $S $POSTFIX
|
||||
}
|
||||
|
||||
while true; do
|
||||
displaytime "$SECONDS" >&2
|
||||
sleep 1
|
||||
done
|
||||
Reference in New Issue
Block a user