[MNG-6195] Tidy up quoting and command substitution

This commit is contained in:
Stephen Connolly 2017-03-26 22:41:24 +01:00
parent 00c82b7e23
commit 96543b7c6e
1 changed files with 8 additions and 7 deletions

View File

@ -83,14 +83,14 @@ fi
# For MinGW, ensure paths are in Unix format before anything is touched
if $mingw ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME="`(cd "$MAVEN_HOME"; pwd)`"
MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ] ; then
JAVACMD="`which java`"
JAVACMD=`which java`
else
JAVACMD="$JAVA_HOME/bin/java"
fi
@ -122,13 +122,13 @@ fi
find_maven_basedir() {
(
basedir=`find_file_argument_basedir "$@"`
wdir="`pwd`"
wdir=`pwd`
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir="`cd "$wdir/.."; pwd`"
wdir=`cd "$wdir/.."; pwd`
done
echo "${basedir}"
)
@ -136,13 +136,14 @@ find_maven_basedir() {
find_file_argument_basedir() {
(
basedir="`pwd`"
basedir=`pwd`
found_file_switch=0
for arg in "$@"; do
if [ ${found_file_switch} -eq 1 ]; then
if [ -f "${arg}" ]; then
basedir=$(dirname "$(readlink -f "${arg}")")
basedir=`dirname "${arg}"`
basedir=`cd "${basedir}" && pwd -P`
if [ ! -d "${basedir}" ]; then
echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
exit 1