From 78b3836acf005c33ec4cdcb453f518b6e099c346 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 10 Mar 2022 22:22:00 +0000 Subject: deploy: a7d5161041378ae600affa8955e0c67a7cb1ba65 --- tools/zsh.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tools/zsh.html') diff --git a/tools/zsh.html b/tools/zsh.html index 18be999..cd8385f 100644 --- a/tools/zsh.html +++ b/tools/zsh.html @@ -81,7 +81,7 @@ @@ -276,6 +276,16 @@ echo $bar[2] # 2 echo ${(L)foo} # aabb echo ${(U)foo} # AABB +

Key/values in associative arrays:

+
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

zparseopts [-D] [-E] [-A assoc] specs
 
-- cgit v1.2.3