From: Michael Tremer Date: Sun, 27 May 2012 12:31:56 +0000 (+0000) Subject: Remove sorting algorithm implemented in shell code. X-Git-Tag: 004~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae22de29afc22e50cd63192c0a52b1c59c3ec601;p=network.git Remove sorting algorithm implemented in shell code. Because of the recently remove feature of having an extra /usr partition, we could not use /usr/bin/sort. --- diff --git a/functions.util b/functions.util index f990362f..68e57823 100644 --- a/functions.util +++ b/functions.util @@ -37,30 +37,11 @@ function warning_log() { log WARNING "$@" } -# This function does not exist because we cannot use /usr/bin/sort. -# It implements some kind of bubble sort which is generally very slow -# but we only have to sort very small data. function listsort() { - local list=($@) - local list_prev - local i - local j - local var - while [ "${list[*]}" != "${list_prev}" ]; do - list_prev="${list[*]}" - for j in $(seq 1 ${#list[*]}); do - [ ${j} -ge ${#list[*]} ] && continue - i=$(( ${j} - 1 )) - if [[ "${list[${j}]}" < "${list[${i}]}" ]]; then - var="${list[${i}]}" - list[${i}]="${list[${j}]}" - list[${j}]="${var}" - fi - done - done - - echo "${list[*]}" + for i in $@; do + echo "${1}" + done | sort | tr '\n' ' ' } function listmatch() {