Re: test -nt not sane

2011-08-10 Thread Greg Wooledge
On Wed, Aug 10, 2011 at 03:25:49PM -0400, Chet Ramey wrote: > The man page says: > file1 -nt file2 > True if file1 is newer (according to modification date) than > file2, or if file1 exists and file2 does not. Ah. The "help test" page is shorter: FILE1 -nt FILE2 True if f

Re: test -nt not sane

2011-08-10 Thread Chet Ramey
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

Re: test -nt not sane

2011-08-10 Thread Sam Steingold
> * Curtis Doty [2011-08-10 11:53:52 -0700]: > > They have identical mtimes (as set by touch)--i.e. the directory is > *not* newer than the symlink--but it still outputs "yes". Why? mtime for a symlink comes from stat(), not stat(). anything is newer than a non-existent object. -- Sam Steingold

Re: test -nt not sane

2011-08-10 Thread Greg Wooledge
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 o

test -nt not sane

2011-08-10 Thread Curtis Doty
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