title: Bash -value too great for base (error token is "09") for date string yyyymmdd
body: <p>I am trying to generate a startDate in the format yyyymmdd such that this date is the 1st day of the third last month. For example, the current month is July (07), so I need to get my start date as the 1st day of April (04) - 20150401.</p>
  
  <p>In order to achieve this in bash, I used the following command:</p>
  
  <pre><code>StartDate=$(date -d "-3 month -$(($(date +%d)-1)) days" +"%Y%m%d")
  </code></pre>
  
  <p>However, this is giving me the following error:</p>
  
  <pre><code>line 93: 09: value too great for base (error token is "09")
  </code></pre>
  
  <p>I do not want to change the format of the StartDate variable. For single digit months (1-9), the format should have a leading zero infront of the month number in the yyyymmdd format.</p>
  
  <p>Is there something that I am missing?</p>
  
  <p>Thanks in advance!</p>