summaryrefslogtreecommitdiff
path: root/scripts/rankmirrors.sh.in
diff options
context:
space:
mode:
authorCedric Staniewski <cedric@gmx.ca>2009-11-05 16:55:48 +0100
committerDan McGee <dan@archlinux.org>2009-11-15 19:22:54 -0600
commit5d5070f47d6542a530c8cbe954bb331389b7393f (patch)
treec9e53ca67fdb90ff4f00d26cef3e6d817b31be4a /scripts/rankmirrors.sh.in
parentfb310fc01ed752b4e046138c3695f5482ca54e16 (diff)
downloadpacman-5d5070f47d6542a530c8cbe954bb331389b7393f.tar.xz
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 <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/rankmirrors.sh.in')
-rw-r--r--scripts/rankmirrors.sh.in12
1 files changed, 6 insertions, 6 deletions
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."