0
The following comparison is unnecessary and will never be true:
elif [ "$HORA" -ge 12 -a "$HORA" -lt 06 ]
then
echo "Boa Noite!";
else
Look at the solution:
#!/bin/bash
HORA=$(date +%H)
if [ "$HORA" -ge 6 -a "$HORA" -lt 12 ]
then
echo "Bom dia!";
elif [ "$HORA" -ge 12 -a "$HORA" -lt 18 ]
then
echo "Boa tarde!";
else
echo "Boa noite!";
fi
That code won’t work between
00:00hrs
and06:00hrs
!– Lacobus