# Number Guessing Game - Build a Number Guessing Game - Test 8 not passing

i’ve been looking for a way to pass that test but coudn’t find any. maybe could someone else see or know why it not working.

here is my code:

#!/bin/bash
PSQL=“psql --username=freecodecamp --dbname=guess_game --no-align --tuples-only -c”
NUMBER_TO_GUESS=\$((RANDOM % 1000 + 1))

# echo number to guess \$NUMBER_TO_GUESS

if [[ -z \$1 ]]
then
else
fi

if [[ ! -z \$USER ]]
then
echo “Welcome back, \$USERNAME! You have played \$GAMES_PLAYED games, and your best game took \$BEST guesses.”
else
if [[ \${#USERNAME} -ge 22 ]]
then
GUESSER=\$(\$PSQL “INSERT INTO guesser(username, games_played, best) VALUES(‘\$1’, 1, 255)”)
fi
echo “Welcome, \$USERNAME! It looks like this is your first time here.”
fi

echo “Guess the secret number between 1 and 1000:”

NUMBER_OF_ATTEMPT=0

while true
do
if [[ \$USER_INPUT -eq \$NUMBER_TO_GUESS ]]
then
NUMBER_OF_ATTEMPT=\$((\$NUMBER_OF_ATTEMPT+1))

``````if [[ \$NUMBER_OF_ATTEMPT -lt \$CUR_BEST ]]
then
echo new best : \$NEW_BEST
fi

echo "You guessed it in \$NUMBER_OF_ATTEMPT tries. The secret number was \$NUMBER_TO_GUESS. Nice job!"
break
``````

else
if [[ ! \$USER_INPUT =~ [0-9] ]]
then
NUMBER_OF_ATTEMPT=\$((\$NUMBER_OF_ATTEMPT+1))
echo “That is not an integer, guess again:”
continue
fi

``````if [[ \$USER_INPUT -gt \$NUMBER_TO_GUESS ]]
then
NUMBER_OF_ATTEMPT=\$((\$NUMBER_OF_ATTEMPT+1))
echo "It's lower than that, guess again:"
fi

if [[ \$USER_INPUT -lt \$NUMBER_TO_GUESS ]]
then
NUMBER_OF_ATTEMPT=\$((\$NUMBER_OF_ATTEMPT+1))
echo "It's higher than that, guess again:"
fi
``````

fi
done

## And here’s SQL dump:

– PostgreSQL database dump

– Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

– Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;

SET lock_timeout = 0;

SET idle_in_transaction_session_timeout = 0;

SET client_encoding = ‘UTF8’;

SET standard_conforming_strings = on;

SELECT pg_catalog.set_config(‘search_path’, ‘’, false);

SET check_function_bodies = false;

SET xmloption = content;

SET client_min_messages = warning;

SET row_security = off;

DROP DATABASE guess_game;

– Name: guess_game; Type: DATABASE; Schema: -; Owner: freecodecamp

CREATE DATABASE guess_game WITH TEMPLATE = template0 ENCODING = ‘UTF8’ LC_COLLATE = ‘C.UTF-8’ LC_CTYPE = ‘C.UTF-8’;

ALTER DATABASE guess_game OWNER TO freecodecamp;

\connect guess_game

SET statement_timeout = 0;

SET lock_timeout = 0;

SET idle_in_transaction_session_timeout = 0;

SET client_encoding = ‘UTF8’;

SET standard_conforming_strings = on;

SELECT pg_catalog.set_config(‘search_path’, ‘’, false);

SET check_function_bodies = false;

SET xmloption = content;

SET client_min_messages = warning;

SET row_security = off;

SET default_tablespace = ‘’;

SET default_table_access_method = heap;

– Name: guesser; Type: TABLE; Schema: public; Owner: freecodecamp

CREATE TABLE public.guesser (

games_played integer,

best integer,

);

ALTER TABLE public.guesser OWNER TO freecodecamp;

– Data for Name: guesser; Type: TABLE DATA; Schema: public; Owner: freecodecamp

– PostgreSQL database dump complete

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36`