_ Script based on the current computer time, return the greeting

bin # / bash!
# Author: liusingbon
# Function: According to the current computer time, return the greeting, the script can be set to boot
# 00-12 points in the morning, afternoon 12-18 points, 18-24 points in the evening
after acquiring the date command # time, time interval determined IF, determined the content of greetings
(TM) = $ (date +% H)
IF [$ (TM) 12 is -le]; the then
MSG = "Good Morning $ the USER"
elif [$ (TM) - (TM) -a $ 12 is -le gt 18 is]; the then
MSG = "Good Afternoon $ the USER"
the else
MSG = "$ Good Night the USER"
Fi
echo -e "\ 033 [34m $ MSG \ 033 [0m"
echo "is the current time : $ (date + "% Y- % m-% d% H:% M:% S") "


Guess you like

Origin www.cnblogs.com/liusingbon/p/11140437.html