Patchwork scripts/contrib/*: fix arithmetic bashism

login
register
mail settings
Submitter Paul Eggleton
Date July 17, 2013, 5:29 p.m.
Message ID <1374082177-6873-1-git-send-email-paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/53883/
State Accepted
Commit 7156f30ac32b9bb7718cedf12e868d3e0e0514bc
Headers show

Comments

Paul Eggleton - July 17, 2013, 5:29 p.m.
Apparently $[...] isn't valid in dash, so use $((...)) instead for
mkefidisk.sh and ddimage that both start with $!/bin/sh.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/contrib/ddimage      | 2 +-
 scripts/contrib/mkefidisk.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index ab1d4c7..93ebeaf 100755
--- a/scripts/contrib/ddimage
+++ b/scripts/contrib/ddimage
@@ -39,7 +39,7 @@  device_details() {
 		echo "   model: UNKNOWN"
 	fi
 	if [ -f "/sys/class/block/$DEV/size" ]; then
-		echo "    size: $[$(cat /sys/class/block/$DEV/size)*BLOCK_SIZE] bytes"
+		echo "    size: $(($(cat /sys/class/block/$DEV/size) * $BLOCK_SIZE)) bytes"
 	else
 		echo "    size: UNKNOWN"
 	fi
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 0c15104..bcc2411 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -64,7 +64,7 @@  function device_details() {
 		echo "   model: UNKNOWN"
 	fi
 	if [ -f "/sys/class/block/$DEV/size" ]; then
-		echo "    size: $[$(cat /sys/class/block/$DEV/size)*BLOCK_SIZE] bytes"
+		echo "    size: $(($(cat /sys/class/block/$DEV/size) * $BLOCK_SIZE)) bytes"
 	else
 		echo "    size: UNKNOWN"
 	fi