syntax error near unexpected token `then’ problem solution

#! /bin/bash
#if program test

echo ‘a:’
read a
If [“$a” = “English”]; then
echo “right”
else
echo “wrong”
fi

I wrote the shell script according to the procedure on the video, but “syntax error near token ‘then'” appeared during the execution. After looking at the syntax error near token’ then’ for half a day, I did not find out the reason. After searching the Internet for a long time, I finally understood the reason: There is no space between if and ‘[‘. In addition, when executing, I also found that there must be space on both sides of’ = ‘, otherwise there will be an error, not a syntax error, but no matter what value is assigned to a, the program will get the statement after if is false, thus resulting in wrong.

Read More: