Dynamic Clock in Terminal.

#!/bin/bash
tput civis
while [ 1 ]
do
    tput clear
    # tput cup 10 20
    info=$(date "+%Y-%m-%d %H:%M:%S  %A")
    LEN=`echo $info | wc -c`
    COLS=`tput cols`
    let HOLD_COL=$COLS-$LEN
    NEW_COL=`expr $HOLD_COL / 2`
    tput cup 10 $NEW_COL
    tput setf 2
    tput bold
    echo $info
    sleep 10
done

  

原文地址:https://www.cnblogs.com/standby/p/9473391.html