Christopher Browne wrote: > Nicolas Charles <charl...@gmail.com> writes: > >> Why not simply using : >> >> classes: >> "Last_Saturday" expression => >> "Saturday.((Day31|Day30|Day29|Day28|Day27|Day26|Day25)|(Day24.(April|June|September|November)|(Day23.Day22.February))"; >> >> commands: >> Last_Saturday:: >> "do something"; >> >> It does not take into account leap year, but it should not fail until >> 2020, enough time to find a better solution... >> > > That doesn't seem to require a lot of extra work. BTW, I think it was > supposed to be (Day23|Day22) rather than Day23.Day22, but that bit > changes further if we extend to know about leap years. > > "LeapYear" expression => > "(Yr2004|Yr2008|Yr2012|Yr2016|Yr2020|Yr2024|Yr2028|Yr2032)"; > ### And extend the list whenever you wish to - no particular need to > ### calculate > > > "Last_Saturday" expression => > > "Saturday.((Day31|Day30|Day29|Day28|Day27|Day26|Day25)|(Day24.(April|June|September|November)|(Day23.February)|(Day22.February.!LeapYear)))"; > > Oops, sorry, indeed it was a |
I like your extension with the leap year. Nicolas _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine