osx - How do I do date math in a bash script on OS X Leopard? -


I realize that to do this I can alert a little or ruby ​​program, but I want my Some dependencies as possible to the script

Given that Warning , how does a mathematical calculation date in a bash script on OS X? I have seen a post (on any other site), where someone has done the following:

 Date -d "-1 day" 

but it does not work on OS X .

Appendix:

Many people have commented and have responded that Standards come with OS X like Ruby, Python, Pearl and. I am familiar with all these three languages ​​and can easily write a script which I want. As a matter of fact, I have such a script written in Ruby already.

So perhaps I should explain what 'external dependence' means. What do I mean, I do not want my script to make external calls to any other script. In other words, I want to use some utility available in a vanilla installation of OS X and already on the path.

However, it does not seem that it is possible, so I have to do because of my external dependence: Ruby script

  $ date -v-1d  

- D set daylight saving time flag.

Try the man for more information.


Comments