Am 03/24/17 um 22:51 schrieb Stephen Connolly:
> I am concerned that there are some quoting issues in mvn.
> 
> In some cases we use var=`command` and in others we use var="`command`"
> 
> Additionally we have a mixture of backtick and $(...) style. My
> understanding is that the backticks are for older shells...
> but if that is the case we should use backticks consistently
> 
> line 64: saveddir=`pwd`
> should be? saveddir="`pwd`"
> 
> line 66: MAVEN_HOME=`dirname "$PRG"`/..
> should be? MAVEN_HOME="`dirname "$PRG"`/.."
> 
> line 69: MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
> should be? MAVEN_HOME="`cd "$MAVEN_HOME" && pwd`"
> 
> line 105: CLASSWORLDS_JAR=`echo
> "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
> should be? CLASSWORLDS_JAR="`echo
> "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`"
> 
> line 128:      basedir=$wdir
> should be?      basedir="$wdir"
> 
> line 145:         basedir=$(dirname "$(readlink -f "${arg}")")
> should be?         basedir="$(dirname "$(readlink -f "${arg}")")"
> (or perhaps)        basedir="$(cd "$(dirname "${arg}")" && pwd -P)"
> 
> line 178:  MAVEN_PROJECTBASEDIR=`cygpath --path --windows
> "$MAVEN_PROJECTBASEDIR"`
> should be?  MAVEN_PROJECTBASEDIR="`cygpath --path --windows
> "$MAVEN_PROJECTBASEDIR"`"
> 
> /me got tired looking at the file after this point in time!
>

According to the "Expansion" section from the sh man page
(<http://man.openbsd.org/sh>) the double quotes should be there to
disable field splitting.

[...]
Command expansion has a command executed in a subshell and the results
output in its place.  The basic format is:

$(command)

  or

`command`

The results are subject to field splitting and pathname expansion; no
other form of expansion happens.  If command is contained within double
quotes, field splitting does not happen either.  Within backquotes, a
backslash is treated literally unless it follows a dollar sign,
backquote, or another backslash.  Commands can be nested, though the
backquoted version requires backslashes before the backquotes. If
command is run in a subshell in the bracketed version, the syntax is
identical to that of arithmetic expansion. In that case the shell
attempts arithmetic expansion first, then attempts command substitution
if that fails.  Or a non-ambiguous version can be used:

$( (command) )

Arithmetic expansion works similarly, with an arithmetic expression
being evaluated and substituted. The format is:

$((expression))

Where expression is an integer, parameter name, or array reference,
optionally combined with any of the operators described below, listed
and grouped according to precedence:
[...]

Regards,
-- 
Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to