#!/bin/bash
## Printing key-value pairs from a Bash associative array
unset myarr && declare -A myarr
let myarr["eightytwo"]+=8
let myarr["eightytwo"]+=74
myarr["thirteen"]+=1
myarr["thirteen"]+=3
let myarr["fiftythree"]+=48
let myarr["fiftythree"]+=5
for a in "${!myarr[@]}"; do echo "${a}: ${myarr["$a"]}"; done
No comments:
Post a Comment