Program (wish.sh)
#!/bin/bash
x=`date +%H`
mrd=`date +%P`
if [ $mrd=='am' ]
then
if [ $x -le 11 ]
then
echo "Good Morning"
fi
else
if [ $x -le 2 ]
then
echo "Good Afternoon"
elif [ $x -le 6 ]
then
echo "Good Evening"
else
echo "Good Night"
fi
fi
Output
[vijai@localhost command]$ sh wish.sh
Good Morning
#!/bin/bash
x=`date +%H`
mrd=`date +%P`
if [ $mrd=='am' ]
then
if [ $x -le 11 ]
then
echo "Good Morning"
fi
else
if [ $x -le 2 ]
then
echo "Good Afternoon"
elif [ $x -le 6 ]
then
echo "Good Evening"
else
echo "Good Night"
fi
fi
Output
[vijai@localhost command]$ sh wish.sh
Good Morning
No comments:
Post a Comment