Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
10 years ago

[Resolved] groovy question - escaping $ in string

Hello,
I have a property step, which has the following key-value pair

(key) xml
(value)

PYTEST_ARGS="--junitxml=test-result.xml ${bamboo.global_pytest_args} --browser=${bamboo.browser} -k '${bamboo.global_pytest_key_words}'  bubbles/eventtypes"  


I have a groovy step that just prints out the key value


def xml = context.expand( '${xml_data#xml_definition_data_raw}' )
log.info(xml)


This prints
PYTEST_ARGS="--junitxml=test-result.xml  --browser= -k ''  bubbles/eventtypes" 


Seems like the groovy step starts evaluation the ${...} expressions in the text. I am trying to strip out the '$' from the string but the string is already changed by the time I expand it. Is there a way to reference and print the literal key value ?

Thanks

Ali