changeset 515:7c2ffcc92df6

array.sh: array_print_length() now always returns 0
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 01 Sep 2024 16:55:10 +0200
parents 5da57fa5009f
children 1d1a4c217e38
files share/local-bsdtools/array.sh
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/share/local-bsdtools/array.sh	Sun Sep 01 13:58:01 2024 +0200
+++ b/share/local-bsdtools/array.sh	Sun Sep 01 16:55:10 2024 +0200
@@ -179,6 +179,9 @@
 #:   The number of elements of the array.
 #:   If the array does not exist the output is -1.
 #:
+#: Returns:
+#:   0 (truthy)
+#:
 array_print_length() {
     local __farr_name
 
@@ -189,11 +192,10 @@
 
     if array_length __farr_vn ${__farr_name}; then
         printf "%s" "${__farr_vn}"
-        return 0
     else
         printf "%s" "-1"
-        return 1
     fi
+    return 0
 }