String 通过ANT将值附加到shell脚本中的属性
需要一些关于ant和shell脚本的帮助。 我需要打开一个shell脚本,并使用ant将一些值附加到shell脚本的属性中String 通过ANT将值附加到shell脚本中的属性,string,shell,ant,String,Shell,Ant,需要一些关于ant和shell脚本的帮助。 我需要打开一个shell脚本,并使用ant将一些值附加到shell脚本的属性中 <property name="args" value="${ARGS}"/> <replaceregexp file="abc.sh" match="ARGS=(.*)" replace="ARGS=${args} some_value=true" byline="true" flags="i" /> 下面是我使用ant编写的
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
下面是我使用ant编写的代码-
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
我面临的问题是abc中ARGS的值。sh的格式为ARGS=“value”
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
这段代码的输出是-
ARGS=“value”某些值=真
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
预期产量为-
ARGS=“value some\u value=true”
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
请帮帮我。据我所知,你可以用
来得到你想要的东西。不需要${args}
或${args}
属性
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
在XML中,属性值可以由引号(“
)或单引号(”
)包围。在以下示例中
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
match="..."
replace="..."
…变成
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
match='...'
replace='...'
引号已替换为单引号。使用单引号可以方便地在
的匹配
和替换
属性中使用引号:
<property name="args" value="${ARGS}"/>
<replaceregexp file="abc.sh"
match="ARGS=(.*)"
replace="ARGS=${args} some_value=true"
byline="true"
flags="i" />
替换abc.sh