${(v)…}: Show array values

v used with k show both key and value of an associative array: ${kv}array.

Examples

Show key and values of an associative array
1
2
declare -A data=([4]=joe [3]=william [2]=jack [1]=averell)
echo "Dalton brothers: ${(kvo)data}"
Output:
1
Dalton brothers: 3 william 4 joe 1 averell 2 jack
BashSupport Pro is a Zsh IDE with support for ${(v)…}try it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal