如何使用 date 命令打印下一周?
date +"This is week: %U of %Y, Sprint: %y(W%U-%U)"
输出应该是
This is week: 04 of 2017, Sprint: 17(W04-05)
代替
This is week: 04 of 2017, Sprint: 17(W04-04)
答案1
使用 GNU date
:
date +"This is week: %U of %Y, Sprint: %y(W%U-$(date -d 'now + 7 days' +%U))"
或者:
date +"This is week: %U of %Y, Sprint: %y(W%U-$(date -d 'next week 12:00' +%U))"