-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC3064
Vidar Holen edited this page Apr 11, 2025
·
1 revision
if [ -N file ]
then
echo "File has been modified since last read"
fi
if bash -c '[ -N file ]'
then
echo "File has been modified since last read"
fi
test -N
is not supported by POSIX, and there is no straight forward way of simulating it. If you need this functionality, look into which non-POSIX features your system has to allow this. stat -c
, find -printf
, bash, ksh, and Python are all possible options.
Note that atime
did not turn out to be as useful as first imagined in 1970, and it's generally better not to rely on it.
None. If you expect your shell to support test -N
, either explicitly specify it in the shebang, use a # shellcheck shell=bash
directive, or ignore this warning.
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!