Presumably you have some values for regx
and presumably you are having some sort of IP list
function valid_ip(){
ip=$1
if [[ $ip =~ ^$regx\.$regx\.$regx\.$regx$ ]]; then
return 0
else
return 1
fi
}
0
solved validating IP in bash, CentOS