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

Re: second-one-billion-bug ?

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.
But when I used this test for a second file (with quite old versions 
available), the script returned the oldest with  a time less than one billion.
So my workaround was to add 
	&& [[ `date -s $aux +%s < 800000000 ]].
Perhaps another solution would have been
	&& [[ ${#`date...`} < ${#`date...`} ]]
but I haven't tried this one.
>If I am following you correctly, this is probably a sorting problem. 
>Sort the times as ctimes in numerical, not alphabetical order. Since:
>	99999999 < 1000000000
>	"999999999" > "1000000000"
>Where "" indicates a string. In perl (and I know you're using bash), the 
>difference is `sort ($a $b)` (default alphabetical) versus 
>`sort {$a <=> $b} ($a $b)` (numerical).
>What exact command did you use?
>  James
> James Bromberger <james_AT_rcpt.to> www.james.rcpt.to
> Remainder moved to http://www.james.rcpt.to/james/sig.html

Reply to: