tech-userlevel archive

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

Re: test a -nt b if b doesn't exist



EF> Is there any cons[e]nsus among shell developers what the prefer[e]d
EF> behaviour is?
I just noticed that you understood "shell developers" as "people writing 
shell code" whereas I originally meant "people writing shells".
But, of course, both are interesting.

> Incidentally, this means that, from this point of view, as you described 
> it, bash on NetBSD is buggy.
People could also argue that bash behaving differently on NetBSD than 
elsewhere is buggy.

> As for which behaviour - whether shell builtin or /bin/test - is
> better?  I'm not sure.
Both behave the same way on NetBSD.

> I'd say the test is false regardless of whether the second file exists
Yes, that's documented.

> Personally, I'd tend to treat a nonexistent second file as an
> infinitely old second file: -nt is true and -ot is false.
I tend to concur, but one could also argue that the test should always fail 
if the second file doesn't exist along the lines of "I can't confirm X being 
newer/older than Y because Y doesn't exist".

> Just to complicate things, you/we might arguably want A -nt B to be the
> same as B -ot A, which disagrees with the above two paragraphs.
I wouldn't mind if A -nt B was different from B -ot A, at least not if 
that's documented.


Home | Main Index | Thread Index | Old Index