[英]How to pass the “!” to ant property from parameter?
I have an ant target like this. 我有一个这样的蚂蚁目标。
<target name="test">
<condition property="expression" value="${expression}" else="">
<isset property="expression"/>
</condition>
<echo>Expression is ${expression }</echo>
</target>
I want to set its property with a string which contains logical operators like 我想使用包含逻辑运算符的字符串设置其属性
&& || ! etc.
ant test –Dexpression="A||!B"
ant test –Dexpression="!abc"
But I found it can't accept the exclamation mark "!". 但是我发现它不能接受感叹号“!”。
The echo is 回声是
A||B
abc
How can I pass the "!" 我怎样才能通过“!” to ant property from parameter? 从参数蚂蚁属性?
You need to put expression in single quotes. 您需要将表达式放在单引号中。 This way bash will not interpret it. 这样bash不会解释它。
ant test –Dexpression='A||!B'
ant test –Dexpression='!abc'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.