All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: avoid using length
Date: Fri, 10 Feb 2023 16:53:32 +0000 (GMT)	[thread overview]
Message-ID: <20230210165332.DF730385840D@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cc2293f18ed14f4b306c7e5b92e508a6981b4826
Commit:        cc2293f18ed14f4b306c7e5b92e508a6981b4826
Parent:        30b9d4d4aa7da8dda586fb041b88830bcc2e60de
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Thu Feb 9 14:02:17 2023 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
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


                 reply	other threads:[~2023-02-10 16:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210165332.DF730385840D@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.