DHCPInfo/utils/shared-networks.sh
2023-11-12 17:08:54 -06:00

19 lines
596 B
Bash
Executable File

#!/bin/bash
get_shared_network_declarations () {
local -n HASH_TABLE="${1:?"get_shared_network_declarations: Hash table variable not passed into function"}"
local CONTENT="${2:?"get_shared_network_declarations: Content was not provided"}"
local -a SECTIONS
local SECTION_CONTENT SECTION_NAME
get_sections "$SHARED_NETWORK_BEGIN_REGEX" SECTIONS "$CONTENT"
for i in ${!SECTIONS[@]}; do
SECTION_CONTENT="${SECTIONS[$i]}"
SECTION_NAME=`grep -Eo $SHARED_NETWORK_BEGIN_REGEX <<< "$SECTION_CONTENT" | awk '{ print $2 }' | tr -d \" `
HASH_TABLE[$SECTION_NAME]="$SECTION_CONTENT"
done
}