Breaking News
You are here: Home / Program Code / UNIX / write a script to display the according to the time like good morning, good afternoon, good evening and good night

write a script to display the according to the time like good morning, good afternoon, good evening and good night

$vi time.sh 
x=`date +%H`

if [ $x -gt -5 -a $x -lt 12  ]
then
       echo -e "\n Good mornig "

elif [ $x -lt 4 ]
then
           echo -e "\n Good Afternoon"

elif [ $x -lt 8 ]
then
        echo -e "\n Good Evening "

else
        echo -e "\n Good Night"

fi

:wq

Download Paper Solutions from Below Link

About admin

Scroll To Top