/bin/date and coreutils

Marc André Selig mselig at gmail.com
Mon May 7 11:59:18 PDT 2007


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



More information about the macports-users mailing list