From 5d5070f47d6542a530c8cbe954bb331389b7393f Mon Sep 17 00:00:00 2001 From: Cedric Staniewski Date: Thu, 5 Nov 2009 16:55:48 +0100 Subject: scripts: replace test builtin [ with shell keywords [[ and (( FS#16623 suggested this change for makepkg; this patch applies it to the remaining files in the scripts directory. Signed-off-by: Cedric Staniewski Signed-off-by: Dan McGee --- scripts/rankmirrors.sh.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts/rankmirrors.sh.in') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 015b39a7..d5cbaddd 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -56,8 +56,8 @@ err() { # returns the fetching time, or timeout, or unreachable gettime() { IFS=' ' output=( $(curl -s -m 10 -w "%{time_total} %{http_code}" "$1" -o/dev/null) ) - [[ $? = 28 ]] && echo timeout && return - [[ ${output[1]} -ge 400 || ${output[1]} -eq 0 ]] && echo unreachable && return + (( $? == 28 )) && echo timeout && return + (( ${output[1]} >= 400 || ! ${output[1]} )) && echo unreachable && return echo "${output[0]}" } @@ -96,13 +96,13 @@ finaloutput() { for line in "${sortedarray[@]}"; do echo "${line#* } : ${line% *}" ((numiterator++)) - [[ $NUM -ne 0 && $numiterator -ge $NUM ]] && break + (( NUM && numiterator >= NUM )) && break done else for line in "${sortedarray[@]}"; do echo "Server = ${line#* }" ((numiterator++)) - [[ $NUM -ne 0 && $numiterator -ge $NUM ]] && break + (( NUM && numiterator >= NUM )) && break done fi exit 0 @@ -112,7 +112,7 @@ finaloutput() { # Argument parsing [[ $1 ]] || usage while [[ $1 ]]; do - if [[ "${1:0:2}" = -- ]]; then + if [[ ${1:0:2} = -- ]]; then case "${1:2}" in help) usage ;; version) version ;; @@ -142,7 +142,7 @@ while [[ $1 ]]; do done shift $snum fi - elif [[ -f "$1" ]]; then + elif [[ -f $1 ]]; then FILE="1" IFS=$'\n' linearray=( $(<$1) ) [[ $linearray ]] || err "File is empty." -- cgit v1.2.3-24-g4f1b