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

后端 未结 17 2064
臣服心动
臣服心动 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:13

    Sorry not mentioning I on Solaris system. As such, the -date switch is not available on Solaris bash.

    I find out I can get the previous date with little trick on timezone.

    DATE=`TZ=MYT+16 date +%Y-%m-%d_%r`
    echo $DATE
    

提交回复
热议问题