Number Guessing Game - Build a Number Guessing Game

Tell us what’s happening:

My script runs correctly. But none of the checks are working

Your code so far

 #!/bin/bash

PSQL="psql -U freecodecamp -d number_guess --no-align --tuples-only -c"

echo "Enter your username:"
read USERNAME

USERNAME_QUERY_RESULT=$($PSQL "SELECT user_id FROM users WHERE username = '$USERNAME'")
if [[ -z $USERNAME_QUERY_RESULT ]]
then
  INSERT_USER_RESULT=$($PSQL "INSERT INTO users(username) VALUES('$USERNAME')")
  echo "Welcome, $USERNAME! It looks like this is your first time here."
else
  USER_DATA=$($PSQL "SELECT user_id, username, COUNT(game_id), MIN(tries) FROM users LEFT JOIN games USING(user_id) WHERE username = '$USERNAME' GROUP BY user_id");
  echo "$USER_DATA" | while IFS='|' read ID NAME GAMES BEST
  do
    echo "Welcome back, $NAME! You have played $GAMES games, and your best game took $BEST guesses."
  done
fi

USER_ID=$($PSQL "SELECT user_id FROM users WHERE username = '$USERNAME'")
SECRET_NUMBER=$((1 + $RANDOM % 1000))
TRIES=1
echo "Guess the secret number between 1 and 1000:"
read NUMBER_GUESS
while [[ $NUMBER_GUESS != $SECRET_NUMBER ]]
do
  TRIES=$(($TRIES + 1)) 
  if [[ ! $NUMBER_GUESS =~ ^[0-9]+$ ]]
  then
    echo "That is not an integer, guess again:"
  else
    if [[ $NUMBER_GUESS -gt $SECRET_NUMBER ]]
    then
      echo "It's lower than that, guess again:"
    else
      echo "It's higher than that, guess again:"
    fi
  fi
  read NUMBER_GUESS
done

INSERT_GAME_RESULT=$($PSQL "INSERT INTO games(user_id, tries) VALUES($USER_ID, $TRIES)")
echo "You guessed it in $TRIES tries. The secret number was $SECRET_NUMBER. Nice job!"

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0

Challenge Information:

Number Guessing Game - Build a Number Guessing Game

Hello,
So as it turned out it was the GitPod instance being invalid.

What happened is I started the project night time, got tired, then tried to resume it the next morning.

I reloaded my GitPod instance, had to restart everything and it worked.