I'm trying to compare the last date modified of a file to today's date. If the modification date is before today's date then my script will do one thing, if the date matches todays date i need it to do another. Right now my code looks like this:
date2= ls -l file | awk '{print $6 $7}'
date1= date +%b%d
if (( $(printf "%(%s)T" "$date1") > $(printf "%(%s)T" "$date2") ))
then
echo "date1 is after date2"
else
echo "date1 is not after date2"
fi
This code is not working. Does anyone have any suggestions?
Best Answer
If you have GNU
find
installed, the following line will return the filename if it was last modified earlier than today