main - tests: avoid using length

Zdenek Kabelac <[email protected]>
Newsgroups gmane.linux.lvm.devel
Message-ID <[email protected]>
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cc2293f18ed14f4b306c7e5b92e508a6981b4826
Commit:        cc2293f18ed14f4b306c7e5b92e508a6981b4826
Parent:        30b9d4d4aa7da8dda586fb041b88830bcc2e60de
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Feb 9 14:02:17 2023 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100

tests: avoid using length

Use ${#  for length instead.
---
 test/lib/utils.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 1d1ed48bf..ca9f5ec61 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -87,7 +87,7 @@ mkdtemp() {
 	base_template=$(echo "$template" | sed 's/XX*$//')
 
 	# Calculate how many X's we've just removed.
-	nx=$(expr length "$template" - length "$base_template")
+	nx=$(( ${#template} - ${#base_template} ))
 
 	err=
 	i=1

--
lvm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/lvm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.