#!/bin/bash
# set -x
# Use DONE in order to read until the last line of the file
DONE=false
until $DONE
do
IFS='= ' read -r key val || DONE=true
# If entry is a section, create dictionary using its name
if [[ $key == \[*] ]]; then
key=${key//[/}
key=${key//]/}
section=$key
declare -A eval $section
# If entry has a value, feed the dictionary with key:value
elif [[ $val ]]; then
eval "$section[${key}]=${val}"
fi
done < variables.ini
for file in ${!WARS[@]}; do
echo "WAR file is $file with version: ${WARS[$file]}"
done
for file in ${!SQL[@]}; do
echo "SQL file is $file with version: ${SQL[$file]}"
done
for file in ${!SCRIPTS[@]}; do
echo "SCRIPS file is $file with version: ${SCRIPTS[$file]}"
done