[ 
https://issues.apache.org/jira/browse/MWRAPPER-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17655497#comment-17655497
 ] 

ASF GitHub Bot commented on MWRAPPER-88:
----------------------------------------

gnodet commented on code in PR #79:
URL: https://github.com/apache/maven-wrapper/pull/79#discussion_r1063556378


##########
maven-wrapper-distribution/src/resources/mvnw:
##########
@@ -118,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then
       JAVACMD="$JAVA_HOME/bin/java"
     fi
   else
-    JAVACMD="`\\unset -f command; \\command -v java`"
+    JAVACMD="$(\\unset -f command; \\command -v java)"

Review Comment:
   ```
   JAVACMD="$("unset" -f command 2>/dev/null; "command" -v java)"
   ```
   This above seems to work on bash and zsh:
   ```
   ➜  ~ zsh  -li
   ➜  ~ JAVACMD="$("unset" -f command 2>/dev/null; "command" -v java)" ; echo 
$JAVACMD
   /Users/gnodet/.jenv/shims/java
   ➜  ~ bash -li
   gnodet-mac:~ gnodet$ JAVACMD="$("unset" -f command 2>/dev/null; "command" -v 
java)" ; echo $JAVACMD
   /usr/bin/java
   gnodet-mac:~ gnodet$ 
   ```





> mvnw is not POSIX compatible
> ----------------------------
>
>                 Key: MWRAPPER-88
>                 URL: https://issues.apache.org/jira/browse/MWRAPPER-88
>             Project: Maven Wrapper
>          Issue Type: Bug
>          Components: Maven Wrapper Scripts
>    Affects Versions: 3.1.1
>            Reporter: Benjamin Marwell
>            Assignee: Benjamin Marwell
>            Priority: Major
>              Labels: posix
>
> * POSIX scripts should not use bash-specific features
>  * Fix suggestions from shellcheck 
> ([https://github.com/apache/maven-wrapper/pull/74])



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to