Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

odd even in shell script

# HOW TO FIND A NUMBER IS EVEN OR ODD IN SHELL SCRIPT
clear 
echo "---- EVEN OR ODD IN SHELL SCRIPT -----"
echo -n "Enter a number:"
read n
echo -n "RESULT: "
if [ `expr $n % 2` == 0 ]
then
	echo "$n is even"
else
	echo "$n is Odd"
fi
Source by tutorialsinhand.com #
 
PREVIOUS NEXT
Tagged: #odd #shell #script
ADD COMMENT
Topic
Name
1+4 =