command not found

Asked

Viewed 212 times

0

One more newbie question

echo "Enter an integer number"
read int
checkNum=$(( int % 2 ))

if [$checkNum -eq '0' ]; then

 echo "the number is even"
else
  echo "the number is odd"
fi

Error when I enter any number:

./test4.sh: line 9: [0: command not found the number is Odd

  • 3

    I think you forgot the spacing in your if, the correct would be if [ $checkNum -eq '0' ]; then

  • It worked!!! Thank you... until you hit me with these spaces....

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.