]> sourceware.org Git - lvm2.git/commitdiff
tests: utils.sh arithmetic
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 29 Jun 2017 08:19:32 +0000 (10:19 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 29 Jun 2017 20:23:17 +0000 (22:23 +0200)
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
$ is unnecessary on arithmetic variables.

test/lib/utils.sh

index fa072ba18ff09583769b56f12e0a3a99c64040f0..6a4664933908a2f755a794985e9eabd27bd91570 100644 (file)
@@ -97,7 +97,7 @@ mkdtemp() {
                err=$(mkdir -m 0700 "$candidate_dir" 2>&1) && \
                        { echo "$candidate_dir"; return; }
                test $MAX_TRIES -le $i && break;
-               i=$(expr $i + 1)
+               i=$(( i + 1 ))
        done
        die "$err"
 }
@@ -114,7 +114,7 @@ stacktrace() {
        echo "## - $0:${BASH_LINENO[0]}"
        while FUNC=${FUNCNAME[$i]}; test "$FUNC" != "main"; do
                echo "## $i ${FUNC}() called from ${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}"
-               i=$(($i + 1))
+               i=$(( i + 1 ))
        done
 }
 
@@ -150,7 +150,7 @@ STACKTRACE() {
                        test -f "$i" || break  # nothing is found (expands to debug.log*)
                        name=${i##debug.log_}
                        name=${name%%_*}
-                       test "$name" = "DEBUG" && { name="$name$idx" ; idx=$(($idx + 1)) ; }
+                       test "$name" = "DEBUG" && { name="$name$idx" ; idx=$(( idx + 1 )) ; }
                        echo "<======== Debug log $i ========>"
                        sed -e "s,^,## $name: ," "$i"
                done
This page took 0.041694 seconds and 5 git commands to generate.