Gnu/coreutils/File-characteristic-tests
From Get docs
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
file
exists.- ‘
-s file
’ True if
file
exists and has a size greater than zero.- ‘
file1 -nt file2
’ True if
file1
is newer (according to modification date) thanfile2
, or iffile1
exists andfile2
does not.- ‘
file1 -ot file2
’ True if
file1
is older (according to modification date) thanfile2
, or iffile2
exists andfile1
does not.- ‘
file1 -ef file2
’ True if
file1
andfile2
have the same device and inode numbers, i.e., if they are hard links to each other.- ‘
-N file
’ True if
file
exists and has been modified (mtime) since it was last read (atime).