I am trying to produce a random number, then, if that number is 5, echo "winner". if the number isn't 5, it should echo "loser".
So the random number part works, but for whatever reason it always prints loser even if 5 does come up from the random number generator. how do I fix this?
So the random number part works, but for whatever reason it always prints loser even if 5 does come up from the random number generator. how do I fix this?
Code:
#!/bin/bash
NUMBER=$((1 + RANDOM % 10))
echo $NUMBER
if $NUMBER == 5
then
echo WINNER
else
echo LOSER
fi
Last edited by a moderator: