码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本实现动态时钟

时间:2016-06-25 23:18:12      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:动态

    1. #!/bin/bash
    2. tput civis
    3. while [ 1 ]
    4. do
    5.    tput clear
    6.    tput cup 3 10
    7.    tput setb 0
    8.    tput setf 2
    9.    echo -e "\e[1;32m$(date "+%Y-%m-%d %H:%M:%%A")\e[0m"
    10.    sleep 1
    11. done
在Xshell中运行会有闪屏,不太正常;在本地运行一切正常

    1. #!/bin/bash
    2. watch -n 1 date +"%F %A %T"
通过这个简单命令实现,会显示多余的信息,不够完美




shell脚本实现动态时钟

标签:动态

原文地址:http://hiyang.blog.51cto.com/10728919/1792844

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!