Running ant script in bash script with command line parameters containing a dollar sign -
i have problem in passing string containing dollar sign ant script.
in tclist text file,
org.apache.jmeter.gui.action.load$test testfile3
in bash script,
while read tcls tmethod echo ${tcls},${tmethod} ant -dtcls="$tcls" -dtmethods="$tmethod" done < $tclist
in ant script,
<echo message="run ${tcls}, ${tmethods}."/> <junit haltonerror="false" haltonfailure="false" printsummary="true" fork="true"> <test name="${tcls}" todir="${result.junit.dir}" methods="${tmethods}"/> </junit>
bash echo message,
org.apache.jmeter.gui.action.load$test,testfile3
ant echo message,
[echo] run org.apache.jmeter.gui.action.load, testfile3.
the echo message shows substring after dollar sign disappears... i'm stuck in problem hours. there way print whole string?
update: temporary remedy... couldn't find reason this, solved problem. add "/" after "$" in tclist not removed in ant script. next, use sed expression in ant script replace "$/" "$". comment here(https://stackoverflow.com/a/6151678/1900548) helps me come idea. if knows exact reason problem, please let me know. thanks.
in tclist text file,
org.apache.jmeter.gui.action.load$/test testfile3
in ant script,
<exec executable="sed" inputstring="${tcls}" outputproperty="tcls_after"> <arg value="s/$\//$/g"/> </exec> <echo message="run ${tcls_after}, ${tmethods}."/>
ant echo message,
[echo] run org.apache.jmeter.gui.action.load$test, testfile3.
Comments
Post a Comment