Learn Bash Scripting by Building Five Programs - Build Five Programs

Tell us what’s happening:

I did everything in a task but its not validating can someone verify i didn’t do an error

The error : Your script should “read” input into the suggested variable correctly

Tell us what’s happening:

I did everything in a task but its not validating can someone verify i didn’t do an error
that’s my 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”)
N=$(( RANDOM % 6 ))
GET_FORTUNE() {
echo Ask a yes or no question:
read QUESTION
}
GET_FORTUNE()
echo ${RESPONSES[$N]}

Your code so far

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

GET_FORTUNE() {
echo Ask a yes or no question:
read QUESTION
}

GET_FORTUNE()

echo ${RESPONSES[$N]}

Challenge Information:

Learn Bash Scripting by Building Five Programs - Build Five Programs

This the instructions :
In your function after you print the sentence, use read to get user input into a variable named QUESTION .
[/quote]

Your code so far

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

GET_FORTUNE() {
echo Ask a yes or no question:
read QUESTION
}

GET_FORTUNE()

echo ${RESPONSES[$N]}

Challenge Information:

Learn Bash Scripting by Building Five Programs - Build Five Programs

This the instructions :
In your function after you print the sentence, use read to get user input into a variable named QUESTION .

can you show us a screenshot?

sure

image

can you - very carefully - click the Reset button and wait very patiently for it to reset coderoad and the script?
Do not interrupt it once you you confirm that you want to reset the step.
Then try again.
(the key here is patience, as this reset button is finicky and if you interrupt it, your environment may be permanently broken)

isn’t it going to reset all my work ?

it is going to reset this step. Just don’t interrupt it or the environment will break permanently.

okay i will try this thanks !

1 Like

its working now thank you very much !

1 Like