Learn Linux, PostgreSQL, Git, and Bash Scripting – right from the command line (new 300-hour freeCodeCamp Certification)

I have this same problem. Can you please let me know the solution?

Hi all, I am unable to connect to the psql server for the Mario Database course. I was able to connect yesterday, but today there is an issue. Can you please help? Venkatesh

I used this–>


psql --username=freecodecamp dbname=mario_database

1 Like

Hi @moT01 - Thanks a lot for all the help and for this wonderful course.

Can you please help to make a video and show the following:

  • how to open a new container? (I cant open using the terminal and always go to VS code and use the GUI)
  • how to save the workspace and reopen the same?
    -how to connect to the psql server in that? (Connecting to the psql server has become a hit or miss for me. Sometimes it works and manier times it does not.)

Thanks a lot for your help! :slight_smile:

Did you close the tutorial or vscode and try to reopen and continue @venkateshrnaik?

Your best bet is to finish a tutorial in one session. Closing it and trying to reopen and continue can have issues sometimes. If you ls -a in the terminal there, and don’t see a few folders - you will likely need to start over, unfortunately. If you do see the folders, there’s a series of commands that run when you initially load a tutorial, that don’t get run when trying to continue. I will try and fix this. If you see those folders, you could try running all those commands (line 5-17) in the terminal and see if you can continue from there.

Edit: actually, I think you only need to run the last one - sudo service postgresql start, then you can try logging in again and continuing.

2 Likes

Yes, I did close VS code. Unfortunately, the files aren’t present. Thank you for your help, @moT01. :slight_smile:

Hi All,
I have this question regarding the Learn Bash Scripting by Building Five Programs course.

Need some help with this step: QUESTION1=“What’s your name?”. Do I have to open nano editor to open the questionnaire file and then create a variable? Any help would be appreciated! :slight_smile: cc: @moT01

Thanks,
Venkatesh

No you don’t have to.
Since you are in VS code, you can just open up the questionnaire.sh file and make the edits there.
On the left hand side of VS code click on the explorer option and you will see the file you just created. Open that up and edit it from there

Hope that helps!

3 Likes

Thank you so much :slight_smile:

Stuck on this step. Any more hints?

Hi @philsawa !

Have you tried reseting the lesson?
Sometimes for me, I would get the answer correct but it wouldn’t accept it.
Then I would reset the lesson and it would go through.
You can try that

Does resetting the lesson mean re-starting from the beginning? If so, I’d like to avoid having to re-do everything. It’s really cool the way it leads you through some interesting concepts, but I’ve spent more than 7 hours on this lesson alone so far, spanning multiple weeks.

Hey @philsawa,

I believe you should see the “Try again…” line after entering something that doesn’t end with a question mark. I don’t see that in your screen shot.

Try making the function and loop look like this:

function 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
}

until [[ $QUESTION =~ \?$ ]]
do
  GET_FORTUNE again
done

Clicking the reset button in your screenshot should reset only that step, putting everything where it would be at the start of the step. It looks like perhaps your code got a little off track of where it was intended to be on this step. So if you reset, it would change the fortune.sh file to what it was intended to look like at the beginning of that step (as well as all the other files). If my first suggestion doesn’t work, I would try that. Let us know if either of them work :+1:

1 Like

I tried the “reset” button (thanks so much for explaining what that does!) It put the code in that you suggested. Now I am stuck on the next step…

…tried the reset button a few more times but it doesn’t seem to edit the file like it did the first time…

Learn Bash Scripting by Building Five Programs

Awesome. One last thing. Add an empty line in front of where you print the response.

  1. Change the existing echo ${RESPONSES[$N]} line

  2. Use the -e flag and the new line ( \n ) character with the echo statement

  3. Make sure to use quotes so it prints the new line

  4. Run the script and see if it’s working

  5. The suggested command should look like this: echo -e "\n${RESPONSES[$N]}"

__

Code placed in by “Reset” button:

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

function 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

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

__

Bash:

~~ Fortune Teller ~~

Ask a yes or no question:
go
Try again. Make sure it ends with a question mark:
go?

No

__

Tried rebuilding the container but the only error message I get is: “Test runner failed”

I am working on the Building a Mario Database tutorial in the Relational Database Certification. I am pretty sure that I am stuck because of a bug. Attached is a picture of where I am at (I just updated Daisy’s favorite color to Orange). The error message is '“characters” should have the correct rows for “Daisy” and “Yoshi”. ’ There were no updates for Yoshi in the instructions so that row should still be correct. I have also attached a picture of my current table. The command I used was UPDATE characters SET favorite_color=‘Orange’ WHERE name=‘Daisy’; .Is it me or is there a problem with the tutorial?


Type this is the psql terminal and see if it is getting resolved —>

SELECT * FROM characters ORDER BY character_id;

Hi @moT01, I am working on the World Cup Database course.

I have a question about this activity:

Should I come up with logic in Bash so that duplicates aren’t added or just rely on the “Unique” constraint of the “team” Column in the teams table?

Thanks,
Venkatesh

Hey @moT01 - Thanks a lot for this great project course. :smiley: I completed the Worldcup Database course and got the required output.

The CodeRoad test checker is not able to tick mark the last check about queries.sh. Can you please help and let me know if I missed something?

Thanks,
Venkatesh

Hey @venkateshrnaik,

In the example output, I see:

2014|Germany
2018|France

Yours has France on the top. Hopefully, that’s the only issue. I would try sorting them in your query.

1 Like

Yes, that was the only issue. Thanks for the catch :slight_smile:

Final step on the BIKE RENTAL {look at mee typing in all-caps on autopilot: }
It says to input the following:
SELECT * FROM bikes;
but when I do, it gives an error.

Also earlier encountered a spot where spaces were required after the "#"s in the comments: