Polish "Fix shellcheck warnings in CLI's bash script"

Closes gh-11458
pull/14661/head
Andy Wilkinson 6 years ago
parent 69b844cb13
commit fcc73c6d88

@ -36,14 +36,14 @@ if [ -z "${JAVA_HOME}" ]; then
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
fi
else
javaExecutable="$(which javac)"
javaExecutable="$(command -v javac)"
if [[ -z "$javaExecutable" || "$(expr "${javaExecutable}" : '\([^ ]*\)')" = "no" ]]; then
echo "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
exit 1
fi
# readlink(1) is not available as standard on Solaris 10.
readLink=(which readlink)
[ $(expr "$readLink" : '\([^ ]*\)') = "no" ] && {
readLink="$(command -v readlink)"
[ "$(expr "${readLink}" : '\([^ ]*\)')" = "no" ] && {
echo "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
exit 1
}
@ -87,10 +87,10 @@ if [ -z "${SPRING_HOME}" ]; then
fi
done
SAVED="$(pwd)"
cd "$(dirname "${PRG}")/../" >&-
cd "$(dirname "${PRG}")/../" >&- || exit 1
SPRING_HOME="$(pwd -P)"
export SPRING_HOME
cd "$SAVED" >&-
cd "$SAVED" >&- || exit 1
fi
if [ ! -d "${SPRING_HOME}" ]; then
@ -103,7 +103,7 @@ CLASSPATH=.:${SPRING_HOME}/bin
if [ -d "${SPRING_HOME}/ext" ]; then
CLASSPATH=$CLASSPATH:${SPRING_HOME}/ext
fi
for f in ${SPRING_HOME}/lib/*; do
for f in "${SPRING_HOME}"/lib/*; do
CLASSPATH=$CLASSPATH:$f
done
@ -112,4 +112,5 @@ if $cygwin; then
CLASSPATH=$(cygpath --path --mixed "$CLASSPATH")
fi
"${JAVA_HOME}/bin/java" ${JAVA_OPTS} -cp "$CLASSPATH" org.springframework.boot.loader.JarLauncher "$@"
IFS=" " read -r -a javaOpts <<< "$JAVA_OPTS"
"${JAVA_HOME}/bin/java" "${javaOpts[@]}" -cp "$CLASSPATH" org.springframework.boot.loader.JarLauncher "$@"
Loading…
Cancel
Save