Afficher un message
Vieux 16/03/2008, 06h07   #3
William James
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Time Calculations in Shell

On Mar 15, 6:07 pm, Erwin Lindemann <elind...@wupp.invalid> wrote:
> 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


ruby -rdate -e'p Date:AYNAMES[Date.parse($*[0]).wday]==
"Saturday"' 2008-03-15
  Réponse avec citation
 
Page generated in 0,04695 seconds with 9 queries