Build Five Programs - Build Five Programs

Tell us what’s happening:

I think I encountered a CodeRun/ Codespaces error. The code looks ok to me but on the last step on program 4 I get: “Your script should have the suggests “if” statement added correctly” which is totally unrelated to the modification I had to make(Add an empty line in front of response). I tried hitting Reset and now I get: Test Runner Failed. I tried refresing the page, closing and opening the terminal, nothing works.
I also noticed other users had similar problems, please tell me what’s wrong.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36

Challenge Information:

Build Five Programs - Build Five Programs

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-bash-five-programs/5f5904ac738bc2fa9efecf5a.md at main · freeCodeCamp/freeCodeCamp · GitHub

#!/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]}"

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

Hi @verus2200

Try moving this echo to the last line in the script:

If that doesn’t not work, please post a screen grab of the terminal and instructions.

Happy coding

I did that but I still get “Test Runner Failed” error. That happens since I hit the Reset button.

In the terminal I also get these messages after Reset:

bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory
bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory
bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory
bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory
bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory
bash: /workspace/project/.freeCodeCamp/test/.cwd: No such file or directory
camper: /project$ ./fortune.sh
bash: /workspace/project/.freeCodeCamp/test/.next_command: No such file or directory

~~ Fortune Teller ~~

Don't count on it
Ask a yes or no question:
jhghj

Did you add an empty line in front of where you print the response?

So, like Teller said, put your response line at the end of your script file, then add another echo before it to make an empty line.

Try that.

Yes, I did.

This is the modification the last step needs to complete:

echo -e "\n${RESPONSES[$N]}"

But I as said before, it doesn’t matter if I move the line to the end of the script, now the “Test Runner Failed” error shows up (see printscreen) . This happened after I hit the Reset button, because initially the error I got was “Your script should have the suggests “if” statement added correctly” which in nonsense.

I also tried rebuilding the container and still I get Test Runner Failed.

so no solution? do I have to start over again?

Hi @verus2200

Please post your full code.

Happy coding

Looks like the codespace is stuck and missing files .. can any one confirm after full reset it worked?