file-test
Bash -N — modified after last access
Compares modification and access timestamps. It is not a dependable record of whether an application processed a file: atime policies vary and timestamps can be set explicitly. The example sets both timestamps rather than depending on real-time sleeps. Run the example independently in a fresh private directory. Expected output (one item per line): newer=0; older=1.
Formal Syntax & Structure
bash syntaxbash
[[ -N path ]]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| path | path | File or directory pathname to inspect. |
Return Value
exit status
0 for a true condition; 1 for a false condition. Invalid expressions may fail differently.
Working Example
Example Snippetbash
touch sampletouch -a -t 202001010000 sampletouch -m -t 202001020000 sample[[ -N sample ]]; printf 'newer=%s\n' "$?"touch -a -t 202001030000 sample[[ -N sample ]]; printf 'older=%s\n' "$?"