0

I am trying to do a nested if statement inside of a while loop. I get a unexpected "end of file".

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"

1 Answer 1

1
if [ "$CHOICE" != "x" -o "$CHOICE != "X" ]
                                 ^
                                /
       missing closing quote ---
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.