0

我正在尝试在 while 循环中执行嵌套的 if 语句。我得到一个意外的“文件结尾”。

while :
do
  if [ "$CHOICE" != "x" -o "$CHOICE != "X" ]
  then
    echo "Enter two whole numbers seperated by a space ex:1 123"
    read Num1 Num2
    if echo "$Num1$Num2" | egrep '^[0-9]+$' 2>/dev/null
    then
      # Num1 and Num 2 are INTS
      break
    else
      break
    fi
  else
    # One of the numbers is not an INT
    printf 'Error: You did not enter two whole numbers, Try Again.\n\n'
    continue
  fi
done
echo "$Num1 $Num2"
4

1 回答 1

1
如果 [ "$CHOICE" != "x" -o "$CHOICE != "X" ]
                                 ^
                                /
       缺少结束引号---
于 2013-04-25T17:35:27.647 回答