以下代码段else在它应该进入elif.
#The following line returns 3, 4 or 5 as the exit code.
$BASH_EXEC adbE.sh "adb $ARGUMENT install $f"
echo "the return code:$?."
if [ $? -eq 5 ]
then
#do nothing, success
continue
elif [ $? -eq 4 ]
then
echo "WARNING"
else
echo "ERROR"
break
fi
这部分:echo "the return code:$?."在屏幕上回显:the return code:4.
它不显示WARNING。它只显示ERROR然后中断for包含此代码的循环。
我究竟做错了什么?
以下是我尝试过的导致相同问题的条件比较的变化:
if [ $? -eq 5 ]if [ $? -eq "5" ]if [ $? == 5 ]if [ $? == "5" ]if [[ $? -eq 5 ]]if [[ $? -eq "5" ]]if [[ $? == "5" ]]if [[ $? == 5 ]]