Node: Undefined variables, Next: Defining classes, Previous: Variable substitution, Up: More advanced concepts
Note that macro-variables which are undefined are not expanded as of version 1.6 of cfengine. In earlier versions, undefined variables would be replaced by an empty string, as in Perl. In versions 1.6.x and later, the variable string remains un-substituted, if the varaiable does not exist. For instance,
control: actionsequence = ( shellcommands ) myvar = ( "test string " ) shellcommands: "/bin/echo $(myvar) $(myvar2)"results in:
cfengine:host: Executing script /bin/echo test string $(myvar2) cfengine:host:/bin/echo test : sh: syntax error at line 1: `(' unexpected cfengine:host: Finished script /bin/echo test string $(myvar2)
This allows variables to be defined on-the-fly by modules.