在控制台右上角放置一个时钟 Posted on 2017-03-18 | In Code tput 版本1234567while sleep 1do tput sc tput cup 0 $(($(tput cols)-29)) date tput rcdone & 解释下: tput sc # 记录下当前光标位置 tput cup 0 ….. # 这一句是更改光标到最上一行右起第 29 位置 date # 是打印下当前时间(28 个字符) tput rc # 是恢复先前保留的光标位置 escape codes 版本12345while truedo echo -ne "\e[s\e[0;$((COLUMNS-27))H$(date)\e[u" sleep 1done & 如果您觉得我的经验能够帮助到您,请不吝赏赐,非常感谢! Donate WeChat Pay Alipay