这是我的 shell 脚本和运行它时出现的错误:
#!/bin/bash
path=$1
execute=$2
a=$3
operation=$4
name=$5
if [ "$operation" == "run" ]; then
cd $path
./$execute $a
fi
elif [ "$operation" == "copy" ]; then
mkdir -p $path
cp $execute $path/$name
fi
elif [ "$operation" == "delete" ]; then
rm $path
cd copy
rm $name
cd ..
rmdir copy
fi
./commandsScript.sh: line 14: syntax error near unexpected token `elif' ./commandsScript.sh: line 14: `elif [ "$operation" == "copy" ]; then'
我花了很长时间尝试各种 if-else 语句差异,但没有找到错误解决方案。有人可以帮忙吗?