In bash, one can test whether file1
is older than file2
:
if [[ file1 -ot file2 ]]; then
...
fi
If file1
or file2
(or both) are symbolic links, I want files compared by mtime of symbolic link itself, not the file it points to (i.e. I want bash not to follow symbolic links).
Is it even possible without using an external program? In any case, what is the best way to do it.