So I’m at the end of the fortune script where it shows that I should have the suggested if statement correctly which I did do as per the instructions before I even checked with the GitHub documentation and the script is as same as I wrote so what’s the problem?
Script for fortune.sh
#!/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 ))
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
echo -e "\n${RESPONSES[$N]}\n"