On 8/10/11 2:53 PM, Curtis Doty wrote:
> Or maybe I'm not groking. When one compares against a b0rk symlink, the
> result of -nt (newer than) is true--when it isn't!
> 
>   mkdir directory
>   ln -s noexist symlink
>   touch -hr directory symlink
> 
>   test directory -nt symlink &&echo yes ||echo no
> 
> They have identical mtimes (as set by touch)--i.e. the directory is *not*
> newer than the symlink--but it still outputs "yes". Why?

The man page says:

Unless otherwise specified, primaries that operate on files follow sym-
bolic links and operate on the target of the link, rather than the link
itself.

and

file1 -nt file2
      True if file1 is newer (according  to  modification  date)  than
      file2, or if file1 exists and file2 does not.

file1 exists. file2 does not.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to