$ date -d "yesterday"
Wed Dec 14 21:38:02 CET 2011
$ date -d "last day"
Wed Dec 14 21:38:03 CET 2011
$ date -d "-1 day"
Wed Dec 14 21:38:05 CET 2011
==== OpenBSD ====
$ date -r `expr $(date +%s) - 86400`
Wed Dec 14 22:15:09 CET 2011
==== FreeBSD ====
$ date -v-1d
Wed Dec 14 22:18:18 CET 2011
參考
* https://blog.sleeplessbeastie.eu/2011/12/15/how-to-find-yesterdays-or-tomorrows-date-using-shell/