Bash: check if number is odd or even








n=12
if [[ $((n % 2)) -eq 0 ]]; then
   echo "even"
else
   echo "odd"
fi



No comments:

Post a Comment