0
echo "Enter a number"
read n

rem=$(($n % 2))

if [ $rem == 0 ]
then
echo "$n is even"
else
echo "$n is odd"
f1
0stone0
  • 21,605
  • 3
  • 29
  • 49
  • I copied your script into a `.sh` file, it works, and I only find one error: you should use `=` instead of `==`. (And the last char should be `i`, not `1`, I assume that is a typo. ) Don't use multiple line text in bash. That never worked for me. `%` is supported in bash and `$(())` does arithmetical eval. All good. – WesternGun Oct 12 '21 at 14:25

0 Answers0