title: Bash Shell Current Date Minus Number of Days
body: <p>I am new to bash and shell but I am running a debian install and I am trying to make a script which can find a date in the past without having to install any additional packages. From tutorials I have got to this stage:</p>
  
  <pre><code>#!/bin/sh
  #
  # BACKUP DB TO S3
  #
  
  # VARIABLES
  TYPE="DATABASE"
  DAYS="30"
  
  # GET CURRENT DATETIME
  CURRENTDATE="$(date +%Y%m%d%H%M%S)"
  
  # GENERATE PAST DATE FROM DAYS CONTSTANT
  OLDERDATE=`expr $CURRENTDATE - $DAYS'
  
  # CALL PYTHON SCRIPT WITH OLDERDATE ARGUMENT
  python script.py $OLDERDATE
  </code></pre>
  
  <p>Where I am getting stuck is the fact that my "days" is just the number 30 and isnt datetime formattted, so when I come to minus it from the currentdate variable it obviously isnt compatible. </p>
  
  <p>Would anyone be kind enough to help me find a way to get this working as it should?</p>