Build A Periodic Table Database - First Test Not Passing

Here is my code:

#!/bin/bash

PSQL="psql -X --username=freecodecamp --dbname=periodic_table --tuples-only -c"

if [[ -z $1 ]]
then
  echo "Please provide an element as an argument"
  exit 1
fi

Everything looks right to me, but the test doesn’t pass. Anyone have any ideas? I searched the forum but couldn’t find anyone with the same problem. The truth is that I finished the entire script and none of the tests are passing, even though the output looks right. Please help…

Yehuda

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Try to add a period . at the end as the test is checking for it.

The echo statement would look likt this:

echo "Please provide an element as an argument."

Thanks. That was also a problem, but the solution was changing the exit code to 0. Then all tests passed with my full script and project complete.

1 Like