AIX Shell脚本中的日期处理 [英] Date manipulation in AIX shell script
问题描述
很抱歉,如果它重复了任何旧帖子。如果是这样,请重定向。
Sorry if its repetition of any old post. If so, kindly redirect.
我在AIX中的Shell脚本上工作,我们从文件/命令行获取日期。
现在,我必须将当前日期与输入日期进行比较,并查看相差的天数。
Iam working on a shell script in AIX where we get a date from a file/command line. Now, i have to compare the current date with the input date and see the number of days difference.
我尝试用google搜索其解决方案,但是到处都是最终没有适当的解决方案。
I tried to google for its solution, but everywhere ended up with no proper solution.
在这里,我无法设置 date变量,因为iam不是root用户。
Here i cant set the "date" variable, as iam not a root user.
任何输入都会有很大帮助。
Any inputs would be of great help.
推荐答案
对于稍微复杂一点的事情,我建议使用datecalc(您可以可以在 http://www.unix.com/unix-dummies-questions-answers/4870-days-elapsed-between-2-dates.html#post16559 )。它可以在大多数UNIX方言中实现。
For anything slightly more complicated I'd suggest using datecalc (you can find a version at http://www.unix.com/unix-dummies-questions-answers/4870-days-elapsed-between-2-dates.html#post16559). It's implementable in most UNIX dialects.
这篇关于AIX Shell脚本中的日期处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!