getting network id from ip address & subnetmask getting network id from ip address & subnetmask shell shell

getting network id from ip address & subnetmask


The problem is with quoting the variables fed to the read call. If you do this instead (add the quotes):

IFS=. read -r i1 i2 i3 i4 <<< "$i"IFS=. read -r m1 m2 m3 m4 <<< "$s"

Everything works again. Still not sure why.