👤
Home Man
Search
Today's Posts
Register


Modulo calculation in shell script

Shell Programming and Scripting




Kindly Note - This is a Single User Post by Forum Member harjinder Regarding:
Modulo calculation in shell script.
Please Follow The Primary Link Above to View the Full Discussion.

Old 03-21-2011
Modulo calculation in shell script

hi
i am writing a progrm to print the even numbers and the code which i am following is as follows

Code:
#!/usr/bin/bash
echo "enter a number a"
read a
if [$a % 2 == 0]
then
  echo "the number is even"
else
  echo "the number is odd"
fi

~
what is the mistake i am doing ...please tell me

Last edited by pludi; 03-21-2011 at 05:28 AM.. Reason: Please use code tags