blob: 53185ae347849a7087c299217a4d76a6d97cf392 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/bash
#function that prints a string $1 centered on line $2
#if $3 is c, then it offsets from there
function ceprint ()
{
if [ "$3" == "c" ]; then
vpad=$(( $(( $(tput lines) /2 )) + $2 ))
else
vpad=$2
fi
pad=$(( $(( $(tput cols) - "${#1}" )) / 2 ))
echo -n "["
echo -n $vpad
echo -n ";"
echo -n $pad
echo -n "H"
#echo "[1;2H"
echo $1
}
#main loop variable
LOOP=1
while [ $LOOP -eq 1 ]; do
#Display Date in English
ENGDATE=$(date -d@$(( 1552602480 - $(date +%s) )) \
"+%-j Days %H Hours %M Minutes %S Seconds");
ceprint "$ENGDATE" 1 c
#Reads for 0.5 Seconds, provides rough timing of the loop and allows for
#exit
read -t 0.5 -N 1 READCHAR
if [ "$READCHAR" == "q" ]; then
LOOP=0
fi
done
|