Pages

Subscribe:

Print Message According to System's Time --Shell Script



Write a shell script that prints the message "Good Morning", "Good After Noon", "Good Evening", or " Good night " according to the system's time.


#!/bin/bash
t=""
t=`echo $(date +"%H") `
if [ $t -le 10 -a $t -ge  6 ]
 then
  echo " Good morning "
elif [ $t -gt 10 -a $t -le 16 ]
 then 
 echo " good after noon"
elif [ $t -gt 16 -a $t -le 20 ]
 then 
 echo "good evening "
elif [ $t -gt 20 -a $t -le 5 ]
 then
 echo " good night "
fi



comments powered by Disqus
 

Listed In

Bloggers - Meet Millions of Bloggers http://Link-exchange.comxa.com
Blog Search: The Source for Blogs Internet Blogs

Disclaimer

The contents in this blog are taken from various sources available over the internet, therefore we do not gurantee of it's accuracy, if you find any of the content in the blog is infringing it's copyright, please do email us on '123techguide@gmail.com' and we will make sure to remove the same from the blog at the earliest.