How do I compare the timestamp of two files?
I tried this but it doesn't work:
file1time=`stat -c %Y fil1.txt`
file2time=`stat -c %Y file2.txt`
if[$file1time -gt $file2time];
then
doSomething
fi
I printed both the time stamps, in order and it gives me
1273143480
1254144394
./script.sh: line 13: [1273143480: command not found
So basically if comparison is not working, I guess. Or if there is any other nice way than what I am doing, please let me know. What do I have to change?