index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Cedric Staniewski <cedric@gmx.ca> | 2009-11-05 16:55:48 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-11-15 19:22:54 -0600 |
commit | 5d5070f47d6542a530c8cbe954bb331389b7393f (patch) | |
tree | c9e53ca67fdb90ff4f00d26cef3e6d817b31be4a /scripts/rankmirrors.sh.in | |
parent | fb310fc01ed752b4e046138c3695f5482ca54e16 (diff) |
-rw-r--r-- | scripts/rankmirrors.sh.in | 12 |
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." |