Could you format your code by putting the three backticks at the start and end of the code - and remove the backticks in the middle probably? Make sure the posted code matches what you have.
Also, can you share the instructions for the step you are on?
There are two ways you can format your code to make it easier to read and test:
After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)
Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.
To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor:
Ok so I’m unable to edit my original post so here’s the code with recommendations from the replies! Unfortunately couldn’t figure out how to post a link to my github since freecodecamp doesn’t let you do that for security reasons. But hopefully this code will be editable. Ill attach a screenshot too of the step I’m on, hopefully that helps.
#!/bin/bash
# Program to tell a person's fortune
echo -e "\n~~ Fortune Teller ~~\n"
RESPONSES=("Yes" "No" "Maybe" "Outlook good" "Don't count on it" "Ask again later")
N=$(( $RANDOM % 6 ))
GET_FORTUNE() {
if [[ ! $1 ]]
then
echo Ask a yes or no question:
else
echo Try again. Make sure it ends with a question mark:
fi
read QUESTION
}
GET_FORTUNE
until [[ $QUESTION =~ \?$ ]]
do
GET_FORTUNE again
done
echo ${RESPONSES[$N]}
#!/bin/bash
# Program to tell a person's fortune
echo -e "\n~~ Fortune Teller ~~\n"
RESPONSES=("Yes" "No" "Maybe" "Outlook good" "Don't count on it" "Ask again later")
N=$(( $RANDOM % 6 ))
GET_FORTUNE() {
if [[ ! $1 ]]
then
echo Ask a yes or no question:
else
echo Try again. Make sure it ends with a question mark:
fi
read QUESTION
}
GET_FORTUNE
until [[ 𝑄𝑈𝐸𝑆𝑇𝐼𝑂𝑁 =~ \? ]]
do
GET_FORTUNE again
done
echo ${RESPONSES[$N]}
Did you add any extra code? If so, it might be causing the tests to fail. I see the step after the one you are on asks you to add a GET_FORTUNE call before the until loop. Looks like your code already has that. Perhaps try deleting it?
So Prajaktaa and teller were right about fixing that line of code but unfortunately still not working I have a feeling its what moT01 suggested (though their recommendation of which line of code might be messing up wasn’t right). I think I might just have to restart the course again and hopefully everything goes smoothly. Thanks everyone for the suggestions though!