У меня есть скрипт, проверяющий, актуален ли файл.
updatedate=`ls -l file | sed -e 's/ */ /g' | cut -d' ' -f7` #cut the modification time
nowdate=`date +"%H:%M"`
echo "$updatedate $nowdate"
if [ "$updatedate"="$nowdate" ]
then
echo 'OK'
else
echo 'NOT OK'
fi
Но когда я его запускаю, сравнение всегда верно:
$ ./checkfile
10:04 10:07
OK
$ ./checkfile
10:07 10:07
OK
Почему?