How to escape evaluation statement in launch file?
I'm trying to have something like this in a launch file:
<arg name="astring" value="today the url is http://mydomain.com/$(date +%Y%m%d)" />
I don't intend for the date expression to evaluate in the launch file. I've tried wrapping the entire string, and individual elements, in single quotes. I've also tried escaping the dollar sign with a backslash, or replacing it with the xml code for a dollar sign. None of this seems to work. How do I pass the contents of the arg's value as a string, no matter what's inside of it?
Asked by seanarm on 2018-02-07 18:12:22 UTC
Answers
About arg, I can't say. But for param we do have one solution:
<param name="url" command="bash -c 'printf "today the url is http://mydomain.com/%s" "`date +%Y-%m-%d`"'" />
I'm still figuring out how to pass param as substitution arg (perhaps usingthe same above technique or using launch-prefix in <test> or <node> tag to set environment variable in terminal from where to read), but the above might solve your problem..
Asked by htanwar922 on 2021-01-11 08:23:17 UTC
Comments
The hacky solution is to split the string into two:
"today the url is http://mydomain.com/$"
and"(date +%Y%m%d)"
.Asked by lucasw on 2018-02-07 19:58:43 UTC