From 6ccc0c28536dd267a970b3bf21dfcb42f378cda3 Mon Sep 17 00:00:00 2001 From: jca Date: Thu, 28 Apr 2022 22:11:59 +0000 Subject: [PATCH] Use $(( )) arithmetic expansion instead of `expr something` No need to use an external tool when the shell can handle this basic task. --- regress/sys/ffs/run | 14 +++++++------- regress/sys/ffs/tests/link/05.t | 2 +- regress/sys/ffs/tests/link/15.t | 2 +- regress/sys/ffs/tests/mkdir/11.t | 2 +- regress/sys/ffs/tests/mkfifo/11.t | 2 +- regress/sys/ffs/tests/open/19.t | 2 +- regress/sys/ffs/tests/symlink/11.t | 2 +- regress/sys/ffs/tests/truncate/12.t | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/regress/sys/ffs/run b/regress/sys/ffs/run index 51cd850000e..9a1cc244d3b 100644 --- a/regress/sys/ffs/run +++ b/regress/sys/ffs/run @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: run,v 1.5 2017/01/12 17:15:10 bluhm Exp $ +# $OpenBSD: run,v 1.6 2022/04/28 22:11:59 jca Exp $ # Heavily inspired on FreeBSD's misc.sh. totntest=0 @@ -23,13 +23,13 @@ expect() if [ $? -eq 0 ]; then echo "okay." else - nfail=`expr $nfail + 1` + nfail=$((nfail + 1)) echo "failed:" echo " test\t$*" echo " expect\t$e" echo " result\t$r" fi - ntest=`expr $ntest + 1` + ntest=$((ntest + 1)) } test_check() @@ -38,11 +38,11 @@ test_check() if [ $* ]; then echo "okay." else - nfail=`expr $nfail + 1` + nfail=$((nfail + 1)) echo "failed:" echo " test\t$*" fi - ntest=`expr $ntest + 1` + ntest=$((ntest + 1)) } # Generate a random file/directory name. @@ -57,8 +57,8 @@ for arg in $*; do echo $arg: sed -n 's/^desc=//p' $arg . $arg - totntest=`expr $totntest + $ntest` - totnfail=`expr $totnfail + $nfail` + totntest=$((totntest + ntest)) + totnfail=$((totnfail + nfail)) done echo "${totntest} tests completed, ${totnfail} failed." diff --git a/regress/sys/ffs/tests/link/05.t b/regress/sys/ffs/tests/link/05.t index 6e68dabdfad..a6330ba7f71 100644 --- a/regress/sys/ffs/tests/link/05.t +++ b/regress/sys/ffs/tests/link/05.t @@ -19,7 +19,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done test_check $i -eq 32767 diff --git a/regress/sys/ffs/tests/link/15.t b/regress/sys/ffs/tests/link/15.t index f5be8a48c3b..080b74eb655 100644 --- a/regress/sys/ffs/tests/link/15.t +++ b/regress/sys/ffs/tests/link/15.t @@ -19,7 +19,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done expect ENOSPC link ${n0}/${n1} ${n0}/${n2} umount /dev/vnd1c diff --git a/regress/sys/ffs/tests/mkdir/11.t b/regress/sys/ffs/tests/mkdir/11.t index 8c7cb558727..07ba837dd2c 100644 --- a/regress/sys/ffs/tests/mkdir/11.t +++ b/regress/sys/ffs/tests/mkdir/11.t @@ -17,7 +17,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done expect ENOSPC mkdir ${n0}/${n1} 0755 umount /dev/vnd1c diff --git a/regress/sys/ffs/tests/mkfifo/11.t b/regress/sys/ffs/tests/mkfifo/11.t index 549ab0b9548..3ad390793eb 100644 --- a/regress/sys/ffs/tests/mkfifo/11.t +++ b/regress/sys/ffs/tests/mkfifo/11.t @@ -17,7 +17,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done expect ENOSPC mkfifo ${n0}/${n1} 0644 umount /dev/vnd1c diff --git a/regress/sys/ffs/tests/open/19.t b/regress/sys/ffs/tests/open/19.t index ff22eb05ed2..39d17ed8ccc 100644 --- a/regress/sys/ffs/tests/open/19.t +++ b/regress/sys/ffs/tests/open/19.t @@ -17,7 +17,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644 umount /dev/vnd1c diff --git a/regress/sys/ffs/tests/symlink/11.t b/regress/sys/ffs/tests/symlink/11.t index c9b8f150e84..96e9ce805f1 100644 --- a/regress/sys/ffs/tests/symlink/11.t +++ b/regress/sys/ffs/tests/symlink/11.t @@ -18,7 +18,7 @@ while :; do if [ $? -ne 0 ]; then break fi - i=`expr $i + 1` + i=$((i + 1)) done expect ENOSPC symlink test ${n0}/${n1} umount /dev/vnd1c diff --git a/regress/sys/ffs/tests/truncate/12.t b/regress/sys/ffs/tests/truncate/12.t index 90070c6feee..87eda3f88dc 100644 --- a/regress/sys/ffs/tests/truncate/12.t +++ b/regress/sys/ffs/tests/truncate/12.t @@ -16,7 +16,7 @@ EFBIG|EINVAL) ;; *) echo "not ok ${ntest}" - ntest=`expr ${ntest} + 1` + ntest=$((ntest + 1)) ;; esac expect 0 unlink ${n0} -- 2.20.1