Daily Archives: February 17, 2009

How To Get Yesterday's Date using BASH Shell Scripting

The new short way: $ date -d ’1 day ago’ +’%Y/%m/%d’ 2009/07/21 Or the longer way: Yesterday in epoch seconds $ yesterday=$((`date +’%s’` – 86400)) Get default formatted yesterday’s date $ date -d “1970-01-01 $yesterday sec” Tue Feb 17 01:27:32 … Continue reading

Posted in Linux | 5 Comments