title: How to get past 6 months year and month based on the entered year and month(not present month) in bash shell script?
body: <p>Here is some of the code, I tried. I need to get past 6 months data (year &amp; Month) based on the entered year and month.</p>
  
  <p>Input and Output format:-</p>
  
  <pre><code>*/example program:
    please enter year:2019
    please enter month:05
  
  output:
  201904
  201903
  201902
  201901
  201812
  201811/*
  </code></pre>
  
  <p>My Script:</p>
  
  <pre><code>if [ -z $1 ]
  then
     echo Please enter year.
     exit
  fi ,
  
  if [ -z $2 ]
  then
     echo Please enter month
     exit
  fi ,
  x=0
  while [ "$x" -le 12 ]
  do
  year= date +'%Y%m' -d "$x month ago"
  echo $year
  ((x++))
  </code></pre>