Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a shell program to test whether a given number is even
or odd?

Answer Posted / mani

echo "Enter the Number"
read a
b=`echo "$a % 2"|bc`
if [ $b -eq 0 ]
then
echo "Given Number is Even "
exit
fi
echo " Given Number is odd"

Is This Answer Correct ?    67 Yes 34 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check if the previous command was run successfully?

1002


What is sed in shell script?

993


i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..

2100


What are the four fundamental components of every file system on linux?

1638


What is a shell script? Can you name some of its advantages?

994


What is wc in shell script?

946


How do I run a bin bash script?

988


How to pass an argument to a script?

1119


How do I run a shell script on a mac?

1083


How many fields are present in a crontab file and what does each field specify?

1075


What is a program shell?

998


How does shell scripting work?

1069


How are shells born?

920


What is scripting autism?

1175


What exactly is a shell?

1021