if [[ $1 = +([0-9]).+([0-9]).+([0-9]).+([0-9]) ]] ; then echo $1 is an ip address else echo $1 is not an ip address fi