This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 1ce05f175bbf04f9c01e57e636b479f8bb98e277 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jul 5 10:55:02 2018 +0000 Make code to find CATALINA_HOME consistent with other scripts. Add "..." when using variables that may contain spaces git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1835119 13f79535-47bb-0310-9956-ffa450edef68 --- bin/daemon.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/daemon.sh b/bin/daemon.sh index 920ade1..925f808 100755 --- a/bin/daemon.sh +++ b/bin/daemon.sh @@ -18,20 +18,22 @@ # ----------------------------------------------------------------------------- # Commons Daemon wrapper script. # ----------------------------------------------------------------------------- -# + # resolve links - $0 may be a softlink -ARG0="$0" -while [ -h "$ARG0" ]; do - ls=`ls -ld "$ARG0"` +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then - ARG0="$link" + PRG="$link" else - ARG0="`dirname $ARG0`/$link" + PRG=`dirname "$PRG"`/"$link" fi done -DIRNAME="`dirname $ARG0`" -PROGRAM="`basename $ARG0`" + +DIRNAME="`dirname "$PRG"`" +PROGRAM="`basename "$PRG"`" while [ ".$1" != . ] do case "$1" in @@ -100,10 +102,10 @@ if [ -z "$JAVA_HOME" ]; then if expr "$link" : '/.*' > /dev/null; then JAVA_BIN="$link" else - JAVA_BIN="`dirname $JAVA_BIN`/$link" + JAVA_BIN="`dirname "$JAVA_BIN"`/$link" fi done - test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`" + test -x "$JAVA_BIN" && JAVA_HOME="`dirname "$JAVA_BIN"`" test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd` else JAVA_BIN="$JAVA_HOME/bin/java" --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org