[PATCH -mm] scripts/decodecode: fix for /bin/sh

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: lkml <linux-kernel@...>
Cc: akpm <akpm@...>
Date: Thursday, June 28, 2007 - 1:51 pm

From: Randy Dunlap <randy.dunlap@oracle.com>

Convert substring expressions to be sh-compatible.

Tested by Arne Georg Gleditsch <argggh@dolphinics.no>

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 scripts/decodecode |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.22-rc6-mm1.orig/scripts/decodecode
+++ linux-2.6.22-rc6-mm1/scripts/decodecode
@@ -28,7 +28,7 @@ if [ $marker -eq 0 ]; then
 fi
 
 if [ $marker -ne 0 ]; then
-	beforemark=${code:0:$((marker - 1))}
+	beforemark=`echo "$code" | cut -c-$((${marker} - 1))`
 	echo -n "	.byte 0x" > $T.s
 	echo $beforemark | sed -e 's/ /,0x/g' >> $T.s
 	as -o $T.o $T.s
@@ -36,7 +36,7 @@ if [ $marker -ne 0 ]; then
 	rm $T.o $T.s
 
 # and fix code at-and-after marker
-	code=${code:$marker}
+	code=`echo "$code" | cut -c$((${marker} + 1))-`
 fi
 
 code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'`
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -mm] scripts/decodecode: fix for /bin/sh, Randy Dunlap, (Thu Jun 28, 1:51 pm)