Learn Bash Scripting by Building Five Programs - Build Five Programs

Awesome. One last thing. Add an empty line in front of where you print the response.

When I hit run i get the following error?
Your script should have the suggests "if" statement added correctly
This is is my fortune.sh code

#!/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")
echo ${RESPONSES[5]}
N=$((RANDOM%6))
echo -e "\n${RESPONSES[$N]}"
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

I dont understand yet i see i have done everything right, i need help

I found a solution that worked. :white_check_mark:

#!/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")
echo ${RESPONSES[5]}
N=$((RANDOM%6))
echo -e "\n${RESPONSES[$N]}"
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

In this version, I’ve made the changes specified, and also added comments to clarify what was modified.
Happy Coding. :wink: