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



> /bin/test and the test builtin to /bin/sh are the same source code,
I already supposed that.

> Edgar's question was more on what the definition of -nt should be, when
> the 2nd arg file does not exist.
Right.

> But since no portable script can really use -nt (as it isn't standardised)
> I'm not sure that this is all that important.
It's a pity it's not stadardised, but if different shells behave differently, 
there's little chance it ever will be, no?

I think test -nt/-ot is about the only non-SUS-thing (apart from some find 
operand I forget which one it is) my shell scripts knowingly rely on (I do
sometimes rely on bmake and some non-standard M4 extensions).
I'm avoiding local, which is a pain to do, but using find -newer to 
imitate test -nt looks like to great an overkill. Note that stat(1) isn't SUS 
either, so the only workaround I could think of is parsing two ls -l outputs.


Home | Main Index | Thread Index | Old Index