Date arithmetic in Unix shell scripts

前端 未结 14 1671
生来不讨喜
生来不讨喜 2020-11-27 22:29

I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs.

I\'m using a function to increment a day and another

14条回答
  •  误落风尘
    2020-11-27 22:49

    If the GNU version of date works for you, why don't you grab the source and compile it on AIX and Solaris?

    http://www.gnu.org/software/coreutils/

    In any case, the source ought to help you get the date arithmetic correct if you are going to write you own code.

    As an aside, comments like "that solution is good but surely you can note it's not as good as can be. It seems nobody thought of tinkering with dates when constructing Unix." don't really get us anywhere. I found each one of the suggestions so far to be very useful and on target.

提交回复
热议问题