Bash 语法错误缺少“then”

Bar*_*sch 3 bash makefile make

对于我的 Makefile 中的以下几行,我收到错误

Syntax error: end of file unexpected (expecting "then")
Run Code Online (Sandbox Code Playgroud)

代码:

if [ ! -d upload-api/app-router/ ] then
    git clone someRepo upload-api/app-router/
fi
Run Code Online (Sandbox Code Playgroud)

我试过在括号后加分号,但仍然出现同样的错误

pap*_*mpi 14

您需要将 then 放在下一行或使用分号

if [ ! -d upload-api/app-router/ ] 
then
Run Code Online (Sandbox Code Playgroud)

或者

if [ ! -d upload-api/app-router/ ];then
Run Code Online (Sandbox Code Playgroud)