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

Xiaoguang Wang edited comment on GROOVY-8933 at 1/31/19 2:37 PM:
-----------------------------------------------------------------

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:
{code:java}
@echo off
setlocal enabledelayedexpansion

set str=test

if %str%==test (
set str=another test
echo !str!
echo %str%
){code}
[https://ss64.com/nt/cmd.html]

/V:ON Enable

[delayed environment variable expansion|https://ss64.com/nt/setlocal.html]
{code:java}
this allows a FOR loop to specify !variable! instead of %variable% expanding 
the variable at execution time instead of at input time.{code}


was (Author: wxiaoguang):
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)

Reply via email to