ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Problems using properties containing multiple dollar signs.
Date Wed, 17 Aug 2011 16:32:08 GMT
On Wed, Aug 17, 2011 at 11:04 AM, Holman, Chris <Chris.Holman@bskyb.com> wrote:
> This ant script snippet:
>      <property name="lineOfTestLine" value="$ $$ $$$ $$$$ $$$$$ $$$$$$">
>      <echo message="${lineOfTestLine}">
>
> Prints out:
>     [echo] $ $ $$ $$ $$$ $$$
>

Interestingly, I ran the following test:

<project>
    <property name="test1" value='$ $$ $$$ $$$$ $$$$$ $$$$$$'/>  <!--
Try single quotes -->
    <echo message="TEST #1 = ${test1}/>  <!-- Prints $ $ $$ $$ $$$ $$$-->

    <condition property="test2" value="test2 matches">
        <equals arg1="${test1}" value="$ $$ $$$ $$$$ $$$$$ $$$$$$$"/>
    </condition>
    <echo message="TEST #2: ${test2}"/> <!-- Prints "TEST #2: test2 matches-->

    <condition property="test3" value="test3 matches">
        <equals arg1="${test1}" value="$ $ $$ $$ $$$ $$$"/>
    </condition>
    <echo message="TEST #3: ${test3}"/> <!-- Prints "TEST #3: ${test3}-->
</project>

So, the value of the variable seems correct, but the echo is wrong.

However, this does work:

<project>
    <property name="dlr" value='$'/>
    <property name="test1" value="${dlr} ${dlr}${dlr}
${dlr}${dlr}${dlr} ${dlr}${dlr}${dlr}${dlr}
${dlr}${dlr}${dlr}${dlr}${dlr} ${dlr}${dlr}${dlr}${dlr}${dlr}${dlr}"/>
 <!-- Try single quotes -->
    <echo message="TEST #1 = ${test1}/>  <!-- Prints $ $$ $$$ $$$$
$$$$$ $$$$$$-->

    <condition property="test2" value="test2 matches">
        <equals arg1="${test1}" value="$ $$ $$$ $$$$ $$$$$ $$$$$$$"/>
    </condition>
    <echo message="TEST #2: ${test2}"/> <!-- Prints "TEST #2: test2 matches-->

    <condition property="test3" value="test3 matches">
        <equals arg1="${test1}" value="$ $ $$ $$ $$$ $$$"/>
    </condition>
    <echo message="TEST #3: ${test3}"/> <!-- Prints "TEST #3: ${test3}-->
</project>

So, by declaring a variable equal to "$" and using that instead of
dollar signs seems to work.

-- 
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message