[PATCH] gen_build_files.sh: Remove bashisms

Douglas Mencken dougmencken at gmail.com
Mon May 17 20:10:52 UTC 2010


Patches welcome? Here's mine.
License: Public domain.

--- gen_build_files.sh	2010-05-17 22:00:34.912406823 +0200
+++ gen_build_files_fixed.sh	2010-05-17 22:03:33.893406743 +0200
@@ -1,5 +1,6 @@
 #!/bin/sh
-# bashism:
+# bashism removed:
+# lines 22 and 48 had
 # "read -r" without variable name reads line into $REPLY
 # without stripping whitespace.

@@ -18,9 +19,9 @@

 		s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
 		echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
-		while read -r; do
-			test x"$REPLY" = x"INSERT" && REPLY="$s"
-			printf "%s\n" "$REPLY"
+		while read -r reply; do
+			test x"$reply" = x"INSERT" && reply="$s"
+			printf "%s\n" "$reply"
 		done <"$src" >>"$dst.$$.tmp"

 		if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
@@ -38,9 +39,9 @@

 		s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
 		echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
-		while read -r; do
-			test x"$REPLY" = x"INSERT" && REPLY="$s"
-			printf "%s\n" "$REPLY"
+		while read -r reply; do
+			test x"$reply" = x"INSERT" && reply="$s"
+			printf "%s\n" "$reply"
 		done <"$src" >>"$dst.$$.tmp"

 		if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then

(also attached)
It's easy, isn't it? ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: teh_patch_for_gen_build_files
Type: application/octet-stream
Size: 1170 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100517/6af35e57/attachment.obj>


More information about the busybox mailing list