title: Get yesterday's date in bash on Linux, DST-safe
body: <p>I have a shell script that runs on Linux and uses this call to get yesterday's date in <code>YYYY-MM-DD</code> format:</p>
  
  <pre><code>date -d "1 day ago" '+%Y-%m-%d'
  </code></pre>
  
  <p>It works most of the time, but when the script ran yesterday morning at <code>2013-03-11 0:35 CDT</code> it returned <code>"2013-03-09"</code> instead of <code>"2013-03-10"</code>.</p>
  
  <p>Presumably daylight saving time (which started yesterday) is to blame. I'm guessing the way <code>"1 day ago"</code> is implemented it subtracted 24 hours, and 24 hours before <code>2013-03-11 0:35 CDT</code> was <code>2013-03-09 23:35 CST</code>, which led to the result of <code>"2013-03-09"</code>.</p>
  
  <p>So what's a good DST-safe way to get yesterday's date in bash on Linux?</p>