How do I check the validity of an IP address in a shell script, that is within the range 0.0.0.0 to 255.255.255.255?
0.0.0.0
255.255.255.255
How about this?
# ip route get 10.10.10.100 > /dev/null 2>&1 ; echo $? 0 # ip route get 10.10.10.300 > /dev/null 2>&1 ; echo $? 1
Since the "ip" command checks the validity of IP in itself.