Time Calculations in Shell
Suppose there is a file, f.
Is it possible to calculate every date (in YYYY-MM-DD format) that
a) falls between the last modification date of f and the current time, and
b) is a certain day of the week, say Wednesday or Saturday
in sh?
The idea is, I want to call a program with YYYY-MM-DD as parameter with
YYYY-MM-DD being every Saturday and Wednesday since the last time the
script was run.
In C, I'd probably start with the start date in seconds since the epoch,
check what day of week it is and add number of seconds till desired day of
week and then number of seconds in a week until we're in the future.
Can something like that be done in a shell script?
(preferably POSIX, but GNU should also be available on the target machine)
Thanks
--
Erwin Lindemann
|