Get the date (a day before current time) in Bash

后端 未结 17 2150
臣服心动
臣服心动 2020-11-30 17:54

How can I print the date which is a day before current time in Bash?

17条回答
  •  悲&欢浪女
    2020-11-30 18:16

    yesterday=`date -d "-1 day" %F`
    

    Puts yesterday's date in YYYY-MM-DD format into variable $yesterday.

提交回复
热议问题