vendredi 25 décembre 2020

Does anyone know why modulus operators doesn't working in the following program? [duplicate]

I am trying to perform modulus on current Minute. But program returns true for even minute as well.

currentTimestamp=$(date +"%H:%M:%S")
currentMinute=$(date +"%M")
echo $currentMinute
if [ $currentMinute%2==0 ]
then
echo "true"
else 
echo "false"
fi

Output: when currentMinute=57 still it is return true

Aucun commentaire:

Enregistrer un commentaire