tcsh:打印日期2周前在shell中 [英] tcsh: print date 2 weeks ago in shell
本文介绍了tcsh:打印日期2周前在shell中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在OpenBSD上的tcsh中,我需要在两周前打印一个日期。
In tcsh on OpenBSD, I need to print a date two weeks ago.
例如。如果今天是 2013-03-02
,我需要打印出 2013-02-16
。
E.g. if today is 2013-03-02
, I need to have 2013-02-16
printed out.
推荐答案
这应该可以工作(它工作在GNU日期,我对OpenBSD不太熟悉,所以不知道如果它适用于你) / p>
This should work ( It works on GNU date. I am not very familiar with OpenBSD. So not sure if it works for you )
date -d "now - 14 days" +%Y-%m-%d
这篇关于tcsh:打印日期2周前在shell中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文