No, I don't think so, judging by its manpage[1].

[1] http://developer.apple.com/documentation/Darwin/Reference/ ManPages/man1/date.1.html


Regards,

Elias Pipping

On May 7, 2007, at 8:52 PM, David Liontooth wrote:


In OSX, /bin/date doesn't support the -d switch

    date: illegal option -- d

In the case of sed, I needed the -r switch and found gsed, providing
gnused, in macports, which works great.

The date utility is bundled in coreutils on debian, along with cat chown
df ln and so on -- I imagine this can't easily be ported?

Details:

I run a certain job daily, which puts the results in a directory named
by that day's date.

In a script operating on these results, I need to indicate which
directory to work on by how many days ago it was created.

So I might set up this command in cron:

      work 4

to run the script "work" in the directory created four days ago. 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?

Dave
_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macports-users

_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macports-users

Reply via email to