I wanna Write a Bash script that can print if the number in the last column is odd or even or if no numbers in the line from a text file, the data is looking like this in a db.txt file :
sdn sddjk@gmail 123
ksd 234
sddd sddsd@gmail
i tried this :
#!/bin/bash
input="db.txt"
while IFS=" " read -r rec_column3
do
if [ $((number % 2)) -eq 0 ]; then
echo even
elif [ $((number % 2)) -eq 1 ]; then
echo odd
elif [[ "$rec_column3" != "number" ]]; then
echo not number
else
echo not found
fi
done
output is :
even
even
so can anyone helps me ? tnx