I'm trying to get the date to work properly. The time is 5 pm (1700 hours) now i.e. evening but it always says morning. Here's my code
currenthour="$(date "+ %-H")"
echo $currenthour
if [ $currenthour -gt '12' ] && [ $currenthour -lt '16' ]; then
currenttimeofday="Afternoon"
elif [ $currenthour -gt '16' ] && [ $currenthour -lt '1' ]; then
currenttimeofday="Evening"
else
currenttimeofday="Morning"
fi
echo $currenttimeofday