Bash Is Ipv 4 Adress
is_ipv4_address() {
    local _s=$1
    local -a _parts
    IFS='.' read -ra _parts <<< "$_s"
    if (( ${#_parts[@]} != 4 )); then echo false; return; fi
    local _v
    for _v in "${_parts[@]}"; do
        if [[ -z "$_v" ]] || ! [[ "$_v" =~ ^[0-9]+$ ]]; then
            echo false; return
        fi
        if (( ${#_v} > 1 && ${_v:0:1} == 0 )); then
            echo false; return
        fi
        if (( _v > 255 )); then
            echo false; return
        fi
    done
    echo true
}

This splits the string by dots and validates each part as a normal IPv4 octet.