DHCPInfo/utils/pools.sh

20 lines
587 B
Bash
Raw Permalink Normal View History

#!/bin/bash
get_pool_declerations () {
local SECTION_CONTENT SECTION_NAME
local -n ARRAY="${1:?"get_pool_declerations: Array was not provided"}"
local CONTENT="${2:?"get_pool_declerations: Content to be parsed was not provided"}"
get_sections $POOL_BEGIN_REGEX ARRAY "$CONTENT"
}
get_pool_ranges () {
local -n ARRAY="${1:?"get_pool_range: Variable not passed in"}"
local CONTENT="${2:?"get_pool_range: Content not provided"}"
while read line; do
RANGE="${line/range /}"
RANGE="${RANGE/;/}"
ARRAY+=( "$RANGE" )
done <<< "$( grep -Eo $POOL_RANGE_REGEX <<< "$CONTENT" )"
}