Forum: Cfengine Help
Subject: Mismatched variable parens/braces works
Author: Justin
Link to topic: https://cfengine.com/forum/read.php?3,21533,21533#msg-21533

It’s fairly well known that $() and ${}  are both valid for variable 
interpolation. However, apparently Cfengine just determines if the opening and 
closing delimiters are valid, not whether they match. I don’t know whether this 
was intentional, unexpected-but-okay, or a bug, but I happened to find it when 
I noticed a typo in a co-worker’s code that nevertheless worked. 


bundle agent test {
    vars:
        "stuff" string => "blah";

    reports:
        cfengine_3::
            "() = $(stuff)";
            "{} = ${stuff}";
            "(} = $(stuff}";
            "{) = ${stuff)";
}

# cf-agent -b test -Kf ./test.cf 
R: () = blah
R: {} = blah
R: (} = blah
R: {) = blah
#


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to