Variable Definition

In order to simplify config, you can define variables in $ section.

$ {
    CUSTOM_TTL 10
    VARIABLE Value
}

That variable can be used later in the flow using bash-like syntax, e.g.:

Ping >Remote {
    Ttl $CUSTOM_TTL
}

Please note that, unlike in bash, variables are NOT case-sensitive, i.e. VARIABLE and Variable are the same. Variables are first taken from the local storage.

If variable is not locally defined, value is taken from plugins:

Variables can also be modified using the substitutions below.

Basic Substitution (${VARIABLE})

Substitution with and without braces is supported.

$VARIABLE
${VARIABLE}

Expand with Default (${VARIABLE:-Text})

If variable is preset, the expansion will use it. If variable is not present, the expansion will result in Text being used.

${VARIABLE:-Text}

This results in Value if VARIABLE exists, and in default Text if variable is not preset.

Expand with Default if Empty (${VARIABLE:-Text})

If variable is preset and non-empty, the expansion will use it. If variable is not present, the expansion will result in Text being used.

${VARIABLE:-Text}

This results in Value if VARIABLE is non-empty, and in default Text otherwise.

Expand with Reverse Default (${VARIABLE:+Text})

If variable is preset, the expansion will use the Text value. If variable is not present, it will result in empty result.

${VARIABLE+Text}

This results in Value if VARIABLE exists, result will be empty, otherwise default Text will be used.

Expand with Reverse Default if Empty (${VARIABLE:+Text})

If variable is preset and non-empty, the expansion will use the Text value. If variable is not present, it will result in empty result.

${VARIABLE:+Text}

This results in Value if VARIABLE is non-empty, result will be empty, otherwise default Text will be used.

Expand with Default and Assignment (${VARIABLE=Text})

If variable is non-empty, the expansion will use it. If variable is not present, the expansion will result in Text being used. In addition, variable will be set for the future usage.

${VARIABLE:=Text}

If VARIABLE is empty, default value Text will be returned, and variable will be set to that value.

Expand with Default if Empty and Assignment (${VARIABLE:=Text})

If variable is preset, the expansion will use it. If variable is not present, the expansion will result in Text being used. In addition, variable will be set for the future usage.

${VARIABLE:=Text}

If VARIABLE does not exists, default value Text will be returned, and variable will be set to that value.

Substring Expansion (${VARIABLE:offset})

If only offset is given, resulting variable will be a substring starting at a given index (zero-based).

${VARIABLE:2}

This results in lue.

Substring Expansion with Length (${VARIABLE:offset:length})

If both offset and length are given, resulting variable will be a substring starting at a given index (zero-based) and with a given length.

${VARIABLE:2:2}

This results in lu.

Indirect Expansion (${!VARIABLE})

This will lookup value named VARIABLE.

${!VARIABLE}

This results in value of VALUE variable being used.

Length Expansion (${#VARIABLE})

This will result in the length of variable

${#VARIABLE}

This results in 5.

Uppercase Expansion (${VARIABLE@U})

This will result in the value being converted to uppercase.

${VARIABLE@U}

This results in VALUE.

Uppercase First Expansion (${VARIABLE@u})

This will result in the first letter of a value being converted to uppercase. Please note that casing of other letters will NOT change.

${VARIABLE@u}

This results in Value.

Lowercase Expansion (${VARIABLE@L})

This will result in the value being converted to lowercase.

${VARIABLE@L}

This results in value.