0
這裏是我的shell腳本並運行它時,我得到的錯誤:的if-else在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'
我花了很長時間試圖所有種類如 - else語句的差異,但還沒有找到錯誤解決方案。有人可以幫忙嗎?