title: How to display previous month and year value in unix
body: <p>I required previous month and year value in a variable in Unix . I am not able to find any correct unix command for that.
  Meanwhile I have achieved this requirement through sql command, in ext variable and used it.</p>
  
  <pre><code>ext=`sqlplus -s user/pass &lt;&lt;END
  set feedback off set pagesize 0
  select to_char(add_months(sysdate,-1),'Mon-YYYY') from dual;
  exit;
  END&gt;&gt;`
  </code></pre>
  
  <p>But I was looking if I can achieve this by unix command in which I can get same result as Aug-2016.
  Most close I have got through unix command is by
  ext=<code>date + %b-%Y</code>
  which is giving me current month year value as Sep-2016.
  But I require previous month value and in same format.Can anyone suggest? Thanks.</p>