Adding days to system date then compare to a date

Hi! I am trying to read a file and every line has a specific date as one of its fields.
I want to take that date and compare it to the date today plus 6 days.

while read line
do
   date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD
   if [ date > (date today + 6) ]; then
      ...proceed commands 
   fi
done

i need to accurately add 6 days to the current date and compare it to the date i extracted from the file.
Gurus, please help :slight_smile:

[ $date -gt `date -d "+6 days" +%Y%m%d` ]

I assume you can "substr" date from each line successfully yourself.

1 Like