Bash arrays

From Skytech
Jump to: navigation, search


Arrays - bash

## Declare associate array:
declare -A OFFICES

## Assign data
OFFICES[Southampton]=0

## Loop array
for key in "${!OFFICES[@]}";
do
    echo "openvpn{office=\"${key}\"} ${OFFICES[$key]}" >> ${PROM_METRICS_HTML_FILE}
done