Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ip=''
- if [[ $ip =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
- ip=$( echo $ip | tr '.' ' ' )
- ip=($ip)
- if [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]; then
- echo "Dirección IP valida."
- else
- echo "Dirección IP invalida."
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement