echo " enter first file "
read f1
echo " enter second file "
read f2
a=$(ls -l $f1 | awk '{print $6 $7 $8}')
b=$(ls -l $f2 | awk '{print $6 $7 $8}')
ts1=`date -d"${a}" +%m%d%R`
ts2=`date -d"${b}" +%m%d%R`
if [ $ts1 -gt $ts2 ]
then
echo " file 1 is new "
else
echo " file 2 is new "
fi
showing the invalid date. I am not able to compare the date old file and the new file when I am removing $8 %R not showing any error, I want to compare HOUR AND MIN ALSO