On Wed, 2021-11-17 at 14:06 +0200, Ilkka Virta wrote: > On Wed, Nov 17, 2021 at 1:33 PM Andreas Schwab <sch...@linux-m68k.org> wrote: > > On Nov 17 2021, Michael J. Baars wrote: > > > > > > > > > When -N stands for NEW, and touch (-am) gives you a new file > > > > > > > > It doesn't. The file hasn't been modified after it was last read. > > touch creates the given file if it doesn't previously exist. Immediately > afterwards,it could be called "new" in the usual English meaning, and would > be new in thesense that nothing was done to it > after it was created. But: > $ echo $BASH_VERSION5.1.8(3)-maint > $ rm foo.txt > $ ls -l foo.txt > ls: cannot access 'foo.txt': No such file or directory > $ touch -am foo.txt > $ if test -N foo.txt; then echo is new; else echo is NOT new; fi > is NOT new > > Of course "new" is not an exact concept, it could be defined e.g. to compare > the > file timestamps with the current time. > > > Anyway, the documentation doesn't seem to say 'test -N' tests if the file is > "new".
It seemed logical to assume that '-N' stands for 'new' in some way. The rest of the line does indeed not imply '-N' to be equivalent to 'new'.