I can't find any reference to $[ for arithmetic on the bash man page, but it
seems to be a synonym for $((. mksh doesn't support this, so the expand
tests
that use it fail on Android. No other toybox tests are using $[.
---
 tests/expand.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
From 5824d925c8c9793b3cd7a9ddb9b924f1597aa750 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Sat, 15 Apr 2017 11:27:18 -0700
Subject: [PATCH] Use $(( rather than $[ for arithmetic in expand.test.

I can't find any reference to $[ for arithmetic on the bash man page, but it
seems to be a synonym for $((. mksh doesn't support this, so the expand tests
that use it fail on Android. No other toybox tests are using $[.
---
 tests/expand.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/expand.test b/tests/expand.test
index d93d070..3dcdb1c 100755
--- a/tests/expand.test
+++ b/tests/expand.test
@@ -20,10 +20,10 @@ TABSTOP=1
 BIGTAB=" "
 for i in $(seq $POW); do
     BIGTAB=$BIGTAB$BIGTAB
-    TABSTOP=$[$TABSTOP*2]
+    TABSTOP=$(($TABSTOP*2))
 done
 testing "long tab single" "expand -t $TABSTOP input" "${BIGTAB}foo\n" "\tfoo\n" ""
-testing "long tab tablist" "expand -t $TABSTOP,$[TABSTOP+5] input" \
+testing "long tab tablist" "expand -t $TABSTOP,$((TABSTOP+5)) input" \
         "${BIGTAB}foo  bar\n" "\tfoo\tbar\n" ""
 
 testing "multiline single" "expand -t 4 input" "foo \n    bar\n" "foo\t\n\tbar\n" ""
-- 
2.12.2.762.g0e3151a226-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to