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
#!/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
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
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.