Write a script to display the date, time and a welcome message (like Good Morning etc.). The time should be displayed with “a.m.” or “p.m.” and not in 24 hours notation.

clear

time=date|cut -c12-13

echo “Current time is::”$time

if [ $time -le 11 ]

then

echo A.M

if [ $time -gt 5 -a $time -le 11 ]

then

echo Good Morning

else

echo Good Night

fi

else

echo P.M

if [ $time -lt 15 ]

then

echo Good Afternoon

elif [ $time -lt 20 ]

then

echo Good Evening

else

echo Good Night

fi

fi

 

OUTPUT::

 

Current time is::17

P.M

Good Evening

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.