Difference between revisions of "Bash arrays"

From Skytech
Jump to: navigation, search
(Created page with " category: Linux = Arrays - bash = <pre> ## Declare associate array: declare -A OFFICES ## Assign data OFFICES[Southampton]=0 ## Loop array for key in "${!OFFICES[@]}"...")
 
(No difference)

Latest revision as of 07:17, 23 March 2020


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