I have the following working example of using the
special match variable with file names:
First, we have three files we'll be matching on:
[cfengine00 cfengine_examples]# ls -l /tmp/cf*test*
-rw-r--r-- 1 root root 29 May 14 12:37 /tmp/cf2_test
-rw-r--r-- 1 root root 29 May 14 12:38 /tmp/cf3_test
-rw------- 1 root root 0 May 14 12:41 /tmp/cf3_(test)
[cfengine00 cfengine_examples]#
Our test.cf contains:
bundle agent example
{
files:
"/tmp/(cf[23])_(.*)"
edit_line => myedit("$(match.0) $(match.1) $(match.2)");
}
bundle edit_line myedit(data) {
reports:
"$(data)";
}
Here is what happens when we run it:
[cfengine00 cfengine_examples]# cf-agent -f ./test.cf -b example -KI
>> Using command line specified bundlesequence
R: /tmp/cf2_test cf2 test
R: /tmp/cf3_test cf3 test
R: /tmp/cf3_(test) cf3 (test)
[cfengine00 cfengine_examples]#
So I guess I worked this one out myself. Thank you.
Aleksey
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine