I have a problem in passing a string containing a dollar sign to ant script.
In tclist text file,
org.apache.jmeter.gui.action.Load$Test testFile3
In bash script,
while read tcls tmethod
do
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 that substring after the dollar sign disappears... I'm stuck in this problem for hours. Is there any way to print the whole string?
Update: A temporary remedy... I couldn't find a reason for this, but I solved the problem. I add "/" after "$" in tclist not to be removed in the ant script. Next, I use a sed expression in the ant script to replace "$/" with "$". A comment from here(https://stackoverflow.com/a/6151678/1900548) helps me come up with this idea. If anyone knows the exact reason for this 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.