On Mon, Jul 17, 2017 at 02:14:26PM +0300, Vadim Zhukov wrote: > 2017-07-17 14:03 GMT+03:00 Klemens Nanni <[email protected]>: > > On Mon, Jul 17, 2017 at 11:57:02AM +0300, Vadim Zhukov wrote: > >> > + for _liba in /usr/lib/lib{c,crypto}; do > >> > + _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | > >> > tail -1)" > >> > done > >> > + _libas=${_libas# } > >> > > >> > # Remount read-write, if /usr/lib is on a read-only ffs > >> > filesystem. > >> > if [[ $_mp == *' type ffs '*'read-only'* ]]; then > >> > > >> > >> As a matter of microoptimization we could use "sort -rV | head -1" > >> instead of "sort -V | tail -1". I'm okay with current version of this > >> diff already, though. > > Sorting requires to read the entire input, otherwise you'd only sort a > > subset of the input. I don't see anything being optimized here. > > head -1 returns earlier than tail -1. ;)
I had thought about suggesting this as well, but then I felt it's not worth it: we're talking about a couple of dozen lines max anyway. I committed the diff as it is, thanks!
