[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test -nt not sane

From: Greg Wooledge
Subject: Re: test -nt not sane
Date: Wed, 10 Aug 2011 15:06:37 -0400
User-agent: Mutt/

On Wed, Aug 10, 2011 at 11:53:52AM -0700, Curtis Doty wrote:
>   touch -hr directory symlink

touch: illegal option -- h

Hmm, what is that?  Let's check a GNU/Linux box:

       -h, --no-dereference
              affect each symbolic link instead of any referenced file (useful
              only on systems that can change the timestamps of a symlink)

No wonder I've never seen it before....

>   test directory -nt symlink &&echo yes ||echo no

That leads me to wonder what value bash is actually using when it
tries to compare the timestamp of a broken symlink.  I'd expect it to
use the timestamp of the thing pointed to, but if there's nothing
being pointed to, is it using 0?  As in 1970-01-01 00:00 UTC?
That would certainly explain your result.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]