File characteristic tests (GNU Coreutils 9.0)
From Get docs
Coreutils/docs/latest/File-characteristic-tests
Next: String tests, Previous: Access permission tests, Up: test invocation [Contents][Index]
16.3.3 File characteristic tests
These options test other file characteristics.
- ‘
-e file’ True if
fileexists.- ‘
-s file’ True if
fileexists and has a size greater than zero.- ‘
file1 -nt file2’ True if
file1is newer (according to modification date) thanfile2, or iffile1exists andfile2does not.- ‘
file1 -ot file2’ True if
file1is older (according to modification date) thanfile2, or iffile2exists andfile1does not.- ‘
file1 -ef file2’ True if
file1andfile2have the same device and inode numbers, i.e., if they are hard links to each other.- ‘
-N file’ True if
fileexists and has been modified (mtime) since it was last read (atime).