[Tinyos-devel] backslash problem in tos-locate-jre
Razvan Musaloiu-E.
razvanm at cs.jhu.edu
Wed Jul 4 16:48:44 PDT 2007
Hi!
I just notice a small problem in the tos-locate-jre script from
tinyos-2.x/tools/tinyos/misc/tos-locate-jre. Line 41 is this:
jhome=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\'$jversion'\JavaHome'`
On a bash 3.0 in Linux and a bash 3.2 in Cygwin everything is fine but on
a bash 3.1 on Linux the \' generates a parsing error because backslash is
interpreted as an escape character. The attached script fixes the problem
but escaping all the backslashes.
How the error looks like:
$ ./tos-locate-jre --javac
./tos-locate-jre: line 134: unexpected EOF while looking for matching ``'
./tos-locate-jre: line 147: syntax error: unexpected end of file
$ bash --version
GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
How to apply the patch:
$ cd $TOSROOT
$ patch -p0 < tos-locate-jre.patch
--
Razvan ME
-------------- next part --------------
? tools/tinyos/misc/serial
? tools/tinyos/misc/tinyos.pyc
Index: tools/tinyos/misc/tos-locate-jre
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-locate-jre,v
retrieving revision 1.4
diff -u -r1.4 tos-locate-jre
--- tools/tinyos/misc/tos-locate-jre 7 Jun 2007 07:22:18 -0000 1.4
+++ tools/tinyos/misc/tos-locate-jre 4 Jul 2007 23:35:45 -0000
@@ -38,11 +38,11 @@
case `uname` in
CYGWIN*)
# Hopefully this will always work on cygwin with Sun's Java
- jversion=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion'`
+ jversion=`regtool -q get '\\HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\CurrentVersion'`
if [ $? != 0 ]; then
exit 1
fi
- jhome=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\'$jversion'\JavaHome'`
+ jhome=`regtool -q get '\\HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\'$jversion'\\JavaHome'`
if [ $? != 0 ]; then
exit 1
fi
More information about the Tinyos-devel
mailing list