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



On Fri, Aug 27, 2021 at 05:49:06PM +0200, Edgar Fu? wrote:
 > > 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?

Nah, what happens then is waffling, probably with the result that the
behavior is unspecified if either file doesn't exist.

(me, I think it should be an error. you can always write [ ! -f Y ] ||
[ X -nt Y ].)

 > [...] the only workaround I could think of is parsing two ls -l outputs.

...which you can't do anyway because of locales (even in practice,
because last I remember linux's en_US locales arbitrarily change ls -l
output for no reason.)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index