Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 UNIX 的新手,我做了一些练习,我的目标是获取数字作为参数 - “n”,而不是计算今天的日期减去 n
(TODAY -N = answer)
答案将显示为
date +%a-%b-%d-%Y
我如何以简单的方式做到这一点?提前致谢 :)
你在说,
n=5 date +%a-%b-%d-%Y --date="$n days ago"
?
给Fri-Oct-11-2013
Fri-Oct-11-2013
来源:日期手册页