. confirm.sh
confirm
if [ $? -eq 0 ]
then
echo “Jawaban YES OK”
elif [ $? -eq 1 ]
then
echo “Jawaban NO”
elif [ $? -eq 2 ]
echo “Jawaban CONTINUE”
fi
输出
bash: contest.sh: line 11: syntax error near unexpected token `fi'
bash: contest.sh: line 11: `fi '
答案1
您必须在第二个“elif”后添加“then”。
...
elif [ $? -eq 2 ]
then
echo “Jawaban CONTINUE”
...