Substitution Formats for Variables

There are two substitution formats available for variables to handle special situations where the values returned by the variables need to be manipulated.

Handling Variables With Possible Empty Values

You can use a special substitution format to handle situations when there is the possibility that a variable could return an empty value. The format consists of three arguments in brackets. The first argument is in the form $[? variable]. The second argument determines what to return if variable has a non-empty value. The third argument determines what to return if variable has an empty value.

For example, when using the following expression:

$[? MODULE] [${PS}${MODULE}] []
a path separator, represented by the PS, and the module name are returned if the MODULE variable has a value. If the value of MODULE is empty or there is no MODULE variable defined for the profile, an empty string is returned without the extraneous path separator.

Replacing Characters Returned by a Variable

In some cases, such as when the version control system uses a different path separator than the operating system, it is useful to substitute one character returned by a variable with another character. You can create this substitution by calling the variable, followed by an underscore (_), the character you want to be replaced, and the character you want to substitute.

For example, if you use the following expression in a command:

${PATH_\/}
any backward slashes (\) that are in the value of the profile's PATH variable are replaced with forward slashes (/) when the expression is resolved upon running the command.

See also
Variables in VCS Commands
Creating a New Variable
Runtime Variables
Variable Syntax and Usage
Creating a Custom VCS Profile

Legal Notices