From f673b22d9e515c078c8c12596c20896f7d1d1c2f Mon Sep 17 00:00:00 2001 From: Beartama <8091245+uyha@users.noreply.github.com> Date: Sun, 29 Oct 2023 14:45:37 +0200 Subject: [PATCH] Add add symbol for length of array Using the length operator as is on empty array with `set -u` will lead to unbound variable error --- bash.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash.md b/bash.md index c079175f0a..3f9dde2254 100644 --- a/bash.md +++ b/bash.md @@ -220,9 +220,9 @@ comment ### Length -| Expression | Description | -| ---------- | ---------------- | -| `${#foo}` | Length of `$foo` | +| Expression | Description | +| ------------- | ---------------- | +| `${#foo[@]}` | Length of `$foo` | ### Manipulation