Resolve Syntax Error Near Unexpected Token When Running Bash Script on Mac - VicPhanDevOps/mac GitHub Wiki

• The following resolution is for if you receive syntax error near unexpected token when running a Bash script. Take note of the line number the error falls upon.
image

• Go the line number in the Bash script.
image

• Click the cursor one line above the line the error was reported on and press “return” key to create a new line. Press shift and tab keys to decrease indent and type fi to close the scope of the if statement. Press command and S keys to save.
image

• Return to the Terminal, run the Bash script again and there won’t be an error this time.
image

⚠️ **GitHub.com Fallback** ⚠️