You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
353 B
10 lines
353 B
#! /usr/bin/bash
|
|
|
|
declare -A family
|
|
family=([father]="Homer" [mother]="Marge" [son]="Bart" [daughter]="Lisa" [baby]="Maggie")
|
|
|
|
|
|
echo "Iterating through associative array using while loop:"
|
|
while IFS= read -r key && IFS= read -r value <&3; do
|
|
echo "Key: $key, Value: $value"
|
|
done < <(printf '%s\n' "${!family[@]}") 3< <(printf '%s\n' "${family[@]}")
|
|
|