zoukankan      html  css  js  c++  java
  • 074_根据计算机当前时间,返回问候语,可以将该脚本设置为开机启动

    #!/bin/bash
    #00-12 点为早晨,12-18 点为下午,18-24 点为晚上
    #使用 date 命令获取时间后,if 判断时间的区间,确定问候语内容

    tm=$(date +%H)
    if [ $tm -le 12 ];then
        msg="Good Morning $USER"
    elif [ $tm -gt 12 -a $tm -le 18 ];then
        msg="Good Afternoon $USER"
    else
        msg="Good Night $USER"
    fi

    echo "当前时间是:$(date +"%Y-%m-%d %H:%M:%S")"
    echo -e "33[34m$msg33[0m"

  • 相关阅读:
    windows7触屏编程
    改变窗口大小,恢复以前的大小
    insert()
    index()
    help()
    id()
    extend()
    count()
    cmp()
    append()
  • 原文地址:https://www.cnblogs.com/luwei0915/p/10518732.html
Copyright © 2011-2022 走看看