博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Get the date of the days before today on AIX
阅读量:6996 次
发布时间:2019-06-27

本文共 402 字,大约阅读时间需要 1 分钟。

hot3.png

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 shDAYS=-5DATE=`DAYS=$DAYS perl -MPOSIX -le 'print strftime("%Y%m%d", localtime(time() + $ENV{'DAYS'} *24 *60 *60))'`#echo $DATE

转载于:https://my.oschina.net/oymyisme/blog/504655

你可能感兴趣的文章