
8 GCS Commands
202
Version: 1.2.1
MS249E
C-863.12 Mercury Controller
VAR (Set Variable Value)
Description:
Sets a variable to a certain value.
Local variables can be set using VAR in macros only. See
“Variables”
(p. 118) for more details on local and global
variables.
The variable is present in RAM only.
Format:
VAR <Variable> <String>
Arguments:
<Variable> is the name of the variable whose value is to be
set.
<String> is the value to which the variable is to be set. If
not specified, the variable is deleted.
The value can be specified directly or via the value of a
variable.
Refer to
“Variables”
(p. 118) for more details on
conventions regarding variable names and values.
Response:
None
Example:
It is possible to set the value of one variable (e.g., TARGET)
to that of another variable (e.g., SOURCE):
VAR TARGET ${SOURCE}
Use braces if the name of the variable is longer than one
character:
VAR A ONE
VAR VARB TWO
VAR $A 1
VAR ${VARB} 2
VAR $VARB 2
// this will result in an unwanted behavior
VAR?
A=ONE
VARB=TWO
ONE=1
TWO=2 // ${VARB}
: is replaced by its value “TWO”.
ARB=2 // $VARB
: $V is replaced by its (empty) value.
See ADD (p. 130) for another example.