Bash Scripting - Conditionals - Error: Command not found

Could you please help me with an error I get when doing this exercise?

This is my code:

first_greeting="Nice to meet you!"
later_greeting="How are you?"
if [ $greeting_occasion -lt 1 ] 
  echo $first_greeting
  echo $later_greeting

And this is the results in the terminal:

$./ line 5: [1: command not found
How are you?

So despite the greeting occasion is zero the output is still the later greeting and I just can’t understand why.

You error message doesn’t match your code, you ran something else.

Thanks! I’ve rerun my code and it works, don’t know what I’d run the first time.

1 Like

Not sure if that is necessary, but I have changed if condition from
if [ $greeting_occasion -lt 1 ]
if [ “$greeting_occasion” -lt “1” ] (added “”)
and the error disappeared.