Unix/Linux Go Back    



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 Unix and Linux 03-21-2011   -   Original Discussion by harjinder
harjinder's Unix or Linux Image
harjinder harjinder is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 9 February 2015, 12:23 AM EST
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
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 06:28 AM.. Reason: Please use code tags