Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time it get executed"

Posted By: Adalwolf Fischer     Category: Unix / Linux / Ubuntu     Views: 12869

Write a shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time at which the script is executed.

Code for Shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time it get executed" in Unix / Linux / Ubuntu

check=`date +%H`
echo $check
if [ $check -ge 06 -a $check -le 12 ]
then
        echo "Good morning"
elif [ $check -ge 12 -a $check -le 17 ]
then
        echo "Good afternoon"else
        echo "Good evening"
fi
  
Share: 



Adalwolf Fischer
Adalwolf Fischer author of Shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time it get executed" is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!