Skip to content

Apache Lucene open-source search software

LUCENE-10259: Fix startup scripts to allow whitespace in path names and use /bin/sh only (#472)

Uwe Schindlerd973e50c15cf
diff --git a/lucene/distribution/src/binary-release/bin/luke.cmd b/lucene/distribution/src/binary-release/bin/luke.cmd
index 26f75776bc1..cb8b1e3ece3 100644
--- a/lucene/distribution/src/binary-release/bin/luke.cmd
+++ b/lucene/distribution/src/binary-release/bin/luke.cmd
@@ -17,5 +17,5 @@
SETLOCAL
SET MODULES=%~dp0..
-start javaw --module-path %MODULES%\modules;%MODULES%\modules-thirdparty --add-modules org.apache.logging.log4j --module lucene.luke
+start javaw --module-path "%MODULES%\modules;%MODULES%\modules-thirdparty" --add-modules org.apache.logging.log4j --module lucene.luke
ENDLOCAL
diff --git a/lucene/distribution/src/binary-release/bin/luke.sh b/lucene/distribution/src/binary-release/bin/luke.sh
index e2db65453ef..1593ac6d804 100644
--- a/lucene/distribution/src/binary-release/bin/luke.sh
+++ b/lucene/distribution/src/binary-release/bin/luke.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-MODULES=$(cd $(dirname $0)/.. && pwd)
-java --module-path $MODULES/modules:$MODULES/modules-thirdparty --add-modules org.apache.logging.log4j --module lucene.luke
+MODULES=`dirname "$0"`/..
+MODULES=`cd "$MODULES" && pwd`
+java --module-path "$MODULES/modules:$MODULES/modules-thirdparty" --add-modules org.apache.logging.log4j --module lucene.luke