I need to create three variables, each for Year, Month, and Day for Today\'s date, minus X number of days. For this question I\'ll choose a random amount of days: 222.
epoch=$(( `date '+%s'` - ( 24 * 60 * 60 * 222 ) )) year=`date -d "@$epoch" '+%Y'` month=`date -d "@$epoch" '+%m'` day=`date -d "@$epoch" '+%d'`
Should do the trick.