On Thu, Aug 23 2012, Kim Minh Kaplan <kimminh.kaplan+nomuch@afnic.fr> wrote: > Tomi Ollila : > >> On Tue, Aug 21 2012, Ben Gamari wrote: >> >>> Eh? 1.2.6 is the first Xapian release to have Compactor exposed in the >>> public API. >> >> Presuming that those variables are always numeric the comparison could be: >> >> if [ ${xapian_major_version} -gt 1 ] || >> [ ${xapian_major_version} -eq 1 -a ${xapian_minor_version} -gt 2 ] || >> [ ${xapian_major_version} -eq 1 -a ${xapian_minor_version} -eq 2 -a \ >> ${xapian_subminor_version} -ge 6 ]; then >> >> (I could not figure out anything shorter and/or cleaner) > > Try: > > case "${xapian_version}" in > 0.*|1.[01].*|1.2.[0-5]) ;; > *) ... ;; > esac That sure is shorter -- and splitting xapian_version is not required... .. also that would take care the (improbable?) case that `${xapian_config} -- version` outputs something else than #.#.# in the future. On the other hand, the above doesn't catch junk, so maybe: case ${xapian_version} in 0.*|1.[01].*|1.2.[0-5]) handle no case ;; [1-9]*.[0-9]*.[0-9]*) handle yes case -- approximated test ;; *) failure ;; esac (and we (approximately) expect #.#.#) In any case, excellent idea ! > Kim Minh. Thanks, Tomi