date_dir=`date +%Y-%m-%d -d yesterday` echo "$date_dir" var=`date +%s`; date=`date --date=@$var +%Y-%m-%d` echo $date $ date +%Y-%m-%d -d '-42 days' # This would subtract 42 days from the current date 2013-10-30 $ date +%Y-%m-%d -d '+42 days' # This would add 42 days to the current date 2014-01-22 $ date_dir=$(date +%Y-%m-%d -d '-42 days') $ echo $date_dir 2013-10-30