The task is as followed:
You used the double square brackets with your if statement in the last program, but you can use the double parenthesis with these operators as well. In your script, create an if statement that uses double parenthesis for the condition. Check if the number variable is less than or equal to 15. If it is, use your two variables to print The next number is, B:<number> .
My Code:
#!/bin/bash
# Bingo Number Generator
echo -e "\n~~ Bingo Number Generator ~~\n"
NUMBER=$(( RANDOM % 75 + 1 ))
TEXT="The next number is, "
echo $NUMBER
if (( NUMBER <= 15 ))
then
echo $TEXT B:$NUMBER
fi
Once I save the document or press control+enter I get the following message:
Your script should have the suggested “if” statement added correctly
I’m not exactly new to bash but I need some help figuring out if I’m the issue or the assignment.
That looks pretty correct @Boiob - I would try getting rid of that extra echo $NUMBER above the if. It may be messing with the test. I think it’s extra anyway.
Can you share your code and maybe a screen shot @siddharthasapkota03? Or explain what you are seeing or something. The suggestion I gave worked for Boiob, is yours the same issue?