/bin/date and coreutils

David Liontooth liontooth at cogweb.net
Mon May 7 12:04:47 PDT 2007


Marc André Selig wrote:
> On 5/7/07, David Liontooth <liontooth at cogweb.net> wrote:
>> In OSX, /bin/date doesn't support the -d switch
>
> But it does have the -r switch. ;-)
>
> [...]
>
>> To pick
>> the date, I use
>>
>>     DAY="$(date -d "-$1 day" +%F)"
>>
>> The -d switch allows me to subtract days (or minutes or seconds) from
>> today's date.
>>
>> Is there a way to subtract n days from a date using the OSX date
>> utility?
>
> Something like this?
>
> date -r `date +%s-n*24*60*60|bc` +%F
>
> Regards,
> Marc

Wow, that was fast! So I have a way to do it with the native coreutils.

Dave




More information about the macports-users mailing list