Author: markt Date: Thu Jul 5 10:55:02 2018 New Revision: 1835119 URL: http://svn.apache.org/viewvc?rev=1835119&view=rev Log: Make code to find CATALINA_HOME consistent with other scripts. Add "..." when using variables that may contain spaces
Modified: tomcat/trunk/bin/daemon.sh Modified: tomcat/trunk/bin/daemon.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/daemon.sh?rev=1835119&r1=1835118&r2=1835119&view=diff ============================================================================== --- tomcat/trunk/bin/daemon.sh (original) +++ tomcat/trunk/bin/daemon.sh Thu Jul 5 10:55:02 2018 @@ -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