[Help-bash] How to get a subset of the keys of an associative array?
From:
Peng Yu
Subject:
[Help-bash] How to get a subset of the keys of an associative array?
Date:
Fri, 12 Aug 2016 23:24:19 -0500
Hi, I seems that there is not an equivalent ":" in the usage of
extracting associative array keys. Is there a better way to extract a
subset of the keys of an associative array?
~$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
declare -A assoc_array
assoc_array=([x]=a [y]=b)
echo "address@hidden"
echo "address@hidden:2}"
echo "address@hidden:2}"
~$ ./main.sh
x y
b
--
Regards,
Peng