Tell us what’s happening:
In fortune.sh the command echo -e “\n${RESPONSES[$N]}” isn’t working, when I click Run it says Your script should have the suggests “if” statement added correctly, I’m stuck
Your code so far
#!/bin/bash
Program to tell a persons fortune
echo -e “\n~~ Fortune Teller ~~\n”
RESPONSES=(“Yes” “No” “Maybe” “Outlook good” “Don’t count on it” “Ask again later”)
N=$(( RANDOM % 6 ))
echo -e “\n${RESPONSES[$N]}”
function 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
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Challenge Information:
Learn Bash Scripting by Building Five Programs - Build Five Programs