Hi. I am looking at section "12.3 Variable context match" and it says:
Each time cfengine matches a string, these values are assigned to a special variable context $(match.n). The fragments can be referred to in the remainder of the promise. this makes sense ... in pattern replacement during file editing and ... in searching for files. Then the are two examples, and I don't understand them. What are the files involved? (What is in /home/mark/tmp?) And what does this example do? It does not seem to do anything. bundle agent testbundle { files: "/home/mark/tmp/(cf[23])_(.*)" create => "true", edit_line => myedit("second $(match.2)"); # but more specifically... "/home/mark/tmp/cf3_(test)" create => "true", edit_line => myedit("second $(match.1)"); } So I created two files: /tmp/cf2_test and /tmp/cf3_test. I try to match them: bundle agent example { files: "/tmp/(cf[23])_(.*)" create => "true", edit_line => myedit("second $(match.2)"); "/tmp/cf3_(test)" create => "true", edit_line => myedit("second $(match.1)"); } cf-agent created /tmp/cf3_(test) Why did it create /tmp/cf3_(test) but not /tmp/cf2_(test)? $(match.2) is supposed to match "test", right? And $(match.1) is supposed to match cf2 or cf3, right? And what's with the myedit promise body part which does not exist? Why doesn't cf-agent complain about a missing promise body part? What I am looking for is graspable example of how $match.1 can be used in searching for files, please. Thanks, -at _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine