@Chiang
2019-12-29T15:23:02.000000Z
字数 473
阅读 831
Linux
date +%Y%m%d --date='-1 day'
date -v -1d +%Y-%m-%d
date +%Y%m%d --date='1 day'
date -v +1d +%Y-%m-%d
#!/bin/bash
# author Kang, Leo
# date 2016-5-26
pre_date=0
os_name=$(uname -s)
if [[ "$os_name" == "Linux" ]]; then
#statements
pre_date=$(date +%Y-%m-%d --date='-1 day')
elif [[ "$os_name" == "Darwin" ]]; then
pre_date=$(date -v -1d +%Y-%m-%d)
fi