ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to escape evaluation statement in launch file?

asked 2018-02-07 17:12:22 -0500

seanarm gravatar image

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?

edit retag flag offensive close merge delete

Comments

The hacky solution is to split the string into two: "today the url is http://mydomain.com/$" and "(date +%Y%m%d)".

lucasw gravatar image lucasw  ( 2018-02-07 18:58:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-01-11 07:23:17 -0500

htanwar922 gravatar image

updated 2021-01-11 07:30:23 -0500

About arg, I can't say. But for param we do have one solution:

    <param name="url" command="bash -c 'printf &quot;today the url is http://mydomain.com/%s&quot; &quot;`date +%Y-%m-%d`&quot;'" />

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..

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2018-02-07 17:12:22 -0500

Seen: 356 times

Last updated: Jan 11 '21