fix bashisms in testsuite/
authorMichael Tokarev <mjt@tls.msk.ru>
Sun, 10 Nov 2013 21:01:38 +0000 (22:01 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sun, 10 Nov 2013 21:06:06 +0000 (22:06 +0100)
These places use ${var/search/replace}, $((n++) and
`type -p' constructs which are not-so-standard.
Replace with equivalent constructs.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
testsuite/hostid/hostid-works
testsuite/md5sum.tests
testsuite/testing.sh
testsuite/which/which-uses-default-path

index bcfd717af42bb14a8a3c1e6b5749c11796af452b..8c20bdfcc68a38e1832d7b60f345549d1cb53117 100644 (file)
@@ -1,8 +1,6 @@
 h=x$(busybox hostid)
 # Is $h a sequence of hex numbers?
-x="${h//[0123456789abcdef]/x}"
-x="${x//xxx/x}"
-x="${x//xxx/x}"
-x="${x//xxx/x}"
-x="${x//xx/x}"
-test x"$x" = x"x"
+case "$h" in
+ x*[!0-9a-f]*) false;;
+ *) true;;
+esac
index 1068b083f588e8a97e5edd4fec7e23c0f66f6f14..6c75b6d1c1e1d5a5d1cf48a379cd8277dfe5d083 100755 (executable)
@@ -30,13 +30,13 @@ result=`(
 n=0
 while test $n -le 999; do
        echo "$text" | head -c $n | "$sum"
-       : $((n++))
+       n=$(($n+1))
 done | "$sum"
 )`
 
 if test x"$result" = x"$expected  -"; then
-    echo "PASS: $sum"
-    exit 0
+       echo "PASS: $sum"
+       exit 0
 fi
 
 echo "FAIL: $sum (r:$result exp:$expected)"
index e7e64e58b6a559d5be312964a1283d8c78e79d0f..f5b75694775f5ddf8be8742d820d2a399936b526 100644 (file)
@@ -56,10 +56,10 @@ optional()
 {
        SKIP=
        while test "$1"; do
-               if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then
-                       SKIP=1
-                       return
-               fi
+               case "${OPTIONFLAGS}" in
+                       *:$1:*) ;;
+                       *) SKIP=1; return ;;
+               esac
                shift
        done
 }
index 63ceb9f8f2a58bfcff8c8ae3e3c4bf4c1926efef..349583dcc93ddd5517d20cf38476759e0c7c7055 100644 (file)
@@ -1,4 +1,4 @@
-BUSYBOX=$(type -p busybox)
+BUSYBOX=$(command -pv busybox)
 SAVED_PATH=$PATH
 unset PATH
 $BUSYBOX which ls