0
我正在嘗試在while循環中執行嵌套的if語句。我得到一個意外的「文件結尾」 。Unix for循環,提示輸入值。將值讀入ArrayVar [i]
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"
謝謝!愚蠢的我! – 2013-05-01 08:56:41