Question for ya: how do you do date arithmetic in shell? For example, how do you compute the following values?
- The date of the next Saturday that's the last Saturday of the month
- Today's date + 180 days
- The number of days are left until 31st December
The last one I actually just made up, but the first two are ones I've seen in real-world situations. The first one got "solved" by piping cal into awk (ugh!), but that's kinda horrid. And of course you're in a much better position if you can use GNU date, but not everybody has that luxury.
So does anybody have a reasonably elegant, concise, general shell idiom for this kind of job? Or will this always be one of those situations where you shrug, decide that you've reached the limits of shell, and reach for a real programming language?
Personally I confess to serial abuse of perl -MDate::Manip -e ... Which is of course exactly the kind of grubby non-portable non-solution that I'd rather be avoiding.