You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Xiaoguang Wang (JIRA)" <ji...@apache.org> on 2019/01/31 14:34:00 UTC

[jira] [Commented] (GROOVY-8933) Windows environment don't handle arguments with "!" character correct.

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

Xiaoguang Wang commented on GROOVY-8933:
----------------------------------------

It is not groovy's problem. As long as your write "./xxxx y$yyy" in *nix, the "$" has special means.

 

In Windows, "!" and "%" has special means.

Please try the Windows BAT script here:

{color:#0000ff}@echo{color} {color:#0000ff}off{color}
{color:#0000ff}setlocal{color} enabledelayedexpansion

{color:#0000ff}set{color} str=test

{color:#0000ff}if{color} %str%==test (
 {color:#0000ff}set{color} str=another test
 {color:#0000ff}echo{color} !str!

{color:#0000ff}echo{color} %str%

)

 

[https://ss64.com/nt/cmd.html]

/V:ON Enable

[delayed environment variable expansion|https://ss64.com/nt/setlocal.html]

this allows a FOR loop to specify !variable! instead of %variable% expanding the variable at execution time instead of at input time.

> Windows environment don't handle arguments with "!" character correct.
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-8933
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8933
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.7, 2.5.4
>            Reporter: Marcus Gelderman
>            Priority: Critical
>         Attachments: groovyBugg.groovy
>
>
> Windows environment don't handle arguments with "!" character correct when executed from command line. As this is not the case for Groovy on Unix (macOS). Best guess is that the problems appears when using Windows .bat file to start the Groovy script.
> Run with: groovy groovyBugg.groovy --password !vpm!qa



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)