aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/zsh.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/zsh.md')
-rw-r--r--src/tools/zsh.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/zsh.md b/src/tools/zsh.md
index 7a07a31..ab50644 100644
--- a/src/tools/zsh.md
+++ b/src/tools/zsh.md
@@ -162,6 +162,18 @@ echo ${(L)foo} # aabb
echo ${(U)foo} # AABB
```
+Key/values in associative arrays:
+```zsh
+typeset -A vec; vec[a]='aa'; vec[b]='bb'
+
+echo ${(k)vec} # a b
+echo ${(v)vec} # aa bb
+echo ${(kv)vec} # a aa b bb
+
+# Iterate over key value pairs.
+for k v in ${(kv)vec)}; do ...; done
+```
+
## Argument parsing with `zparseopts`
```zsh