Learn Bash Scripting by Building Five Programs - Build Five Programs

Tell us what’s happening:
I’ve written the code. Then deleted my code and started over again using the same CodeRoad instructions. Then I copied and pasted the hint solution for the if statement exactly as they have it written. I still keep getting the error stating that: “YOUR SCRIPT SHOULD HAVE THE SUGGESTED “IF” STATEMENT ADDED CORRECTLY”

I don’t see what my problem is. The code seems to be working properly as below is my output after the echo text was triggered in my if statement:

~~ Bingo Number Generator ~~

57
codeally@95a644544a4b:~/project$ ./bingo.sh

~~ Bingo Number Generator ~~

5
The next number is, B:5
codeally@95a644544a4b:~/project$

Your code so far
#!/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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Learn Bash Scripting by Building Five Programs - Build Five Programs

Link to the challenge:

Have you tried the reset button?
Also check that you have the code in the exact location they wanted (I can’t see what that is on the screen you shared)

I cut and paste their exact code, and I refreshed the window. I even restarted the class. I’m working on some other coding right now, but once that’s done … I’m going to turn off my computer, wait for 10 seconds, and then turn it back on. I really don’t know what else to do at this point.

I restarted my computer and reset the virtual server but still got the same error message. It finally let me pass when I deleted the ‘echo $NUMBER’ line from my code.

Does the error persist? I might be facing the same challenge

No. I resolved my issue by deleting the “echo $NUMBER” line of code before my “if” statement. I hope this helps you.

1 Like