Re: second-one-billion-bug ?
Jonathan Schmitt <email@example.com> 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.
[[ `date -s $newest +%s` < `date -s $aux +%s` ]]
(compares timestamps as strings, leading to potential mis-sorting)
[ `date -s $newest +%s` -lt `date -s $aux +%s` ]
(compares timestamps as numbers, leading to correct sorting)
[ $newest -of $aux ]
(simple and direct)
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
Finger firstname.lastname@example.org for more info.