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

i am stuck near the learn bash scripting by making five program.Every time when i create the fortune.sh project folder and starts writing bash codes after writing some lines of code i got stuck in making a get_fortune(){} function i tried to check my code but it showed test runner failed and then i reset the page my code is disappers and reappears like this (��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ) . I tried permanently deleting my fortune.sh folder but same thing is happening again and again. Your help will be appreciated
thankyou.

what language are you using on your computer? Can you make sure to set your local keyboard setting to English United States?

1 Like

I am using united states English.

may i send you the screenshot of the error?

yes pls go ahead. I have not heard of this issue before.


I am not able to see my written code after reloading the browser page .I even tried to delete the fortune.sh form the project folder, but still i am getting the same error…

After clicking the hyperlink “do you want to open it anyway?” this happens…

due to this error i can"t complete this task… thankyou for your help…

The message says the file is binary.

I am not sure how it became binary though.
Is it something you created from scratch?

1 Like

yes i did i wrote the code in the terminal as well as in the file too…

I cannot think of an explanation as to why this happened. Normally when we say “touch something.sh” it creates a blank file and then we start typing text into it.

What happens if you delete the file and try to make it again with just a simple echo inside? Are you able to do that much at least?

@moT01 just pinging you to see this interesting new issue.

1 Like

other files are working as it is but this thing is happening to only fortune.sh i don’t know why… i even tried to reset the task couple of times…and deleted fortune.sh again 4-6 time wrote the same thing repeated the same instruction… even i made that fortune.sh executable… even run the array code but when i try to do the taxk mentioned above it does the same error…

Can you take me through the steps in exact detail please?

Start with this.
Can you manually delete the file and then create a new one from the terminal? (touch fortune.sh)

Can you edit the file and write English text and save it?

Can you run the file without any issue?

Just try one thing at a time and note down what happens so we can start ruling out possible causes.

1 Like

step1:touch fortune.sh
step 2: chmod +x fortune.sh
step 3:added a shebang
step 4:add comment
step5:run the file to check its running or not
step7:creating array in terminal
step8:echo single array
step9:echo whole array
step10:declare -p arr
step 11:now making an array of name response…

this is all working? (no problems so far?)

I don’t understand the rest. What command are you running for step 6 (okay you don’t have a 6, so step 7?)
I would like to know the exact command used in each step after this point

Edit: or take a screenshot of the last thing you did that worked.
Then tell me what you did after that that didn’t work (but don’t actually do it this time, just tell me about it)

1 Like

in terminal ARR=(“a” “b” “c”)
then echo ${ARR[1]}
then echo ${ARR[*]}

when i got into the last step the vs code editor refreshed and then my code became like that … i guess… i will delete it and try one more time again… the last lind in which i got stuck was to make a function (GET_FORTUNE)with statement and adding at last the echo ${RESPONSES[$N]}…

please take a screenshot in the last step that works (if you know it)
if you don’t know it, then take a screenshot for each step to be prepared in case the issue happens suddenly or without warning

Thanks for the ping @hbar1st. Yea, I’m not sure what is happening here. You could try the reset button @tushargurg, it should overwrite your file with the intended progress and hopefully supported text.


i did the scripting again .

after reset this happens