String Concatenation and Expressions

There are two different ways to work with variables and strings in Pliant:

  • The JavaScript + operator

  • Template Literals

The JavaScript + operator

In any Pliant parameter, you can use the JS + operator to “add” strings and variables together.

'Hello' + ' ' + 'World'

Here are a few examples in Pliant:

Adding more HTML format text to an existing string
Adding a file extension string to a string variable’s value to create a complete filename

Template Literals

Template literals tend to be more useful when you have a multiline or a more complex piece of text into which you want to insert variable values. In a template literal expression, you wrap the string in backticks (`), and then inside the string you can use variables in a ${$variable_name} format.

Making a BASH script to install a version of etcd on an Ubuntu Linux host:

Building an etcd config file (first half):