Learn-bash-scripting-by-building-five-programs/build-five-programs

you didn’t mention you were getting a syntax error when you ran the script
that shouldn’t be happening.

Are you able to copy the code from coderoad into the file instead of typing it in?
I’m concerned that something you are typing is causing this.

(to copy code, I select it, then right-click and choose copy, then i put my mouse in the script file and right-click choose paste)

sorry i didn’t mentioned about the syntax error .
As i am able to copy past code from code road hints.

i just rewrote it again .This time i just copied the hints.

the syntax error doesn’t like your parenthesis
Can you copy the parentheses exactly as shown? {}
not

{
}

also leave one blank line at the bottom of your script always
(right now the echo statement is the last line not a blank line)


i am unable to copy the code from the black text area

I need you to copy all the code in the script file and post it here in a code block (three backticks on the line above the code and 3 backticks on the line below the code in the forum so we can read it)

#!/bin/bash

#Progam 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 ))

GET_FORTUNE() {}

echo ${RESPONSES[$N]}

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

#!/bin/bash

#Progam 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 ))
GET_FORTUNE() {}
echo ${RESPONSES[$N]}

is it okay now?
I did the preformatted texting.
Is their a way so that i can redo all my fortune.sh tasks with white ticks?

I’m trying to figure out why you are getting that syntax error still.

1 Like

I am so tired getting the same error. Now if i turned of my browser the script will become symbols and i have to do the scripting again form scratch.

okay so the syntax error is not a problem. (it is supposed to happen at this stage)
So then the real issue isn’t that but why the step is not advancing. Still thinking about it.

you said that other courses didn’t have this issue. Do you remember if you may have installed a browser extension since then that may be interfering somehow?

Maybe worth a try to disable all your extensions then close the shell file tab and reopen it again, then type out the line again?

Thank you so much. I’ll disable the extensions, but i remembered one thing that when i am pressing the run button it is showing test runner failed…

yeah unfortunately I don’t have good news for you. If you are seeing test runner failed and can’t get past this step, then you may have to delete the whole container from codeally.io and restart.

ok i’ll do it thank you … do i have to delete my project folder to reset?

in codeally.io go to the Cloud IDE option in the menu then in the playground area, delete the container for the specific course (build five programs…)

1 Like