Hi Rasmus,
ALL_RPMS="`find * -name '*.rpm' -type f | sort`"
# durch sort werden z.B. i586/yast2-core-2.6.47-9.i586.rpm und # i586/yast2-core-2.6.53-8.i586.rpm # schon richtig sortiert (das aeltere File zuerst)
Then the package "foo-10.bla.bla.bla.rpm" will be sorted before the package "foo-9.bla.bla.bla.rpm" which is probably not what you intend. I'm working on a script that does more or less the same as
You have right!! In this case I get not the latest patch. Perhaps an adjusted sort could solve the problem (e.g. sort -t '-' -k '3,3' -n). But after a first glance at the syntax of the filenames it would be impossible to create a sort-construct: 3d_chess-0.8.1-687.i586.rpm 3ddiag-0.496-57.i586.rpm CommonC++-2.0.99.7-29.i586.rpm CommonC++-devel-2.0.99.7-29.i586.rpm acfax-981011-625.i586.rpm alsa-0.9.0.cvs20020903-13.i586.rpm alsa-tools-0.9.0rc1-45.i586.rpm ardour-cvs20020816-21.i586.rpm libaps-2000_04_14-365.i586.rpm perl-XML-RegExp-0.03-216.i586.rpm xview-3.2p1.4-361.i586.rpm emacs-w3-cvs-225.noarch.rpm
NEWEST=`ls -rt $FILES | tail -1`
where $FILES contains a list of all "candidates" for a given package. In my situation, care must be taken so that the dates of the files are not changed.
Perhaps this is the simplest way. I will reflect on this problem too. Best Regards CS -- Christian Stoltze Computer Science, University of Constance (Lake Constance/SW-Germany) Email: Christian.Stoltze@uni-konstanz.de Voice: +49 (0)7531 88-4448 Fax: +49 (0)7531 88-3577