Jonathan Schmitt <[EMAIL PROTECTED]> writes:

> In the first version of this script, the test was:
>       if [[ `date -s $newest +%s` < `date -s $aux` +%s ]]
> and this one worked for one file, where all versions available were not older 
> than two weeks.

As James correctly surmised, the problem was that you were comparing
timestamps as strings rather than as numbers.

BAD:
        [[ `date -s $newest +%s` < `date -s $aux +%s` ]]
(compares timestamps as strings, leading to potential mis-sorting)

OK:
        [ `date -s $newest +%s` -lt `date -s $aux +%s` ]
(compares timestamps as numbers, leading to correct sorting)

BEST:
        [ $newest -of $aux ]
(simple and direct)

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
Finger [EMAIL PROTECTED] for more info.


Reply via email to