Answers for "how to print odd numbers in shell script"

0

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
Posted by: Guest on November-23-2021
1

bash print odd or even lines

# Basic syntax:
sed -n 'n;p' input_file # Print even numbered lines
sed -n 'p;n' input_file # Print odd numbered lines
Posted by: Guest on December-22-2020

Code answers related to "how to print odd numbers in shell script"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language