Get the date of the days before today on AIX

原创
2015/09/10 20:43
阅读数 59

The date command in AIX doesn't support "-d" switch. So it is not easy to get the date of the days before (or after) today.

After research, I think it is best to use perl to compute the date we want.

Here it is:

#!/usr/bin/env sh
DAYS=-5
DATE=`DAYS=$DAYS perl -MPOSIX -le 'print strftime("%Y%m%d", localtime(time() + $ENV{'DAYS'} *24 *60 *60))'`

#echo $DATE

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部