#!/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 "" 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