4

I am trying to set a variable, for example cmd = "echo 25", but it does not work

{% set cmd = "echo {{ id }}" %}

Please help to fix it.

Walrus
  • 309
  • 1
  • 3
  • 16

3 Answers3

3

I found ;)

{% set cmd = "echo " ~ id %}
Walrus
  • 309
  • 1
  • 3
  • 16
1

Try this:

{% set testing = 'it worked' %}
{% set another = testing %}
{{ another }}

Result:

it worked
Vanderson Ramos
  • 341
  • 1
  • 4
  • 15
0

You have to use the join method to concatenate strings and variables.

{% set module = "XYZ" %}
{% set jarfile = [module, '-jar-with-dependencies.jar']|join %}
Vipul Sharda
  • 387
  • 3
  • 6