This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function increment_ipv4 { | |
local ip_base=$1 | |
local incr_amount=$2 | |
local -a ip_components | |
local ip_regex="([0-9]+).([0-9]+).([0-9]+).([0-9]+)" | |
[[ $ip_base =~ $ip_regex ]] | |
ip_components=("${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" "${BASH_REMATCH[4]}") | |
ip_dec=0 | |
local comp | |
for comp in "${ip_components[@]}"; do |