From 64689ce065b15a3a2fed15c2174820c2a7bce1d6 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 10 Oct 2016 13:40:39 +0200 Subject: [PATCH] Fix shellcheck warnings --- update-mirrors | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/update-mirrors b/update-mirrors index 2723066..15f9094 100755 --- a/update-mirrors +++ b/update-mirrors @@ -1,7 +1,7 @@ #!/bin/bash # Functions -function fold () { /usr/bin/fold --spaces --width=$(tput cols); } +function fold () { /usr/bin/fold --spaces --width="$(tput cols)"; } function _urlify-1 () { @@ -13,17 +13,22 @@ function _urlify-1 () function urlify () { - local uitems=($(_urlify-1 $@)) + local uitems=($(_urlify-1 "$@")) local IFS="&" echo "${uitems[*]}" } function make-url () { - local countryparams=$(urlify country ${countries[@]}) - local protocolparams=$(urlify protocol ${protocols[@]}) - local ipparams=$(urlify ip_version ${ip_versions[@]}) - local statusparams=$(urlify use_mirror_status $use_mirror_status) + local countryparams + local protocolparams + local ipparams + local statusparams + + countryparams=$(urlify country "${countries[@]}") + protocolparams=$(urlify protocol "${protocols[@]}") + ipparams=$(urlify ip_version "${ip_versions[@]}") + statusparams=$(urlify use_mirror_status "$use_mirror_status") echo "${url}/?${countryparams}&${protocolparams}&${ipparams}&${statusparams}" } @@ -35,7 +40,7 @@ function load-global-config () for dir in $1; do local cfgfile="${dir}${2}" if [[ -x $cfgfile ]]; then - source $cfgfile + source "$cfgfile" return fi done @@ -49,7 +54,7 @@ cfgfile="/update-mirrors/config.sh" if [[ -x "${cfgbase}${cfgfile}" ]]; then source "${cfgbase}${cfgfile}" else - load-global-config $etcbases $cfgfile + load-global-config "$etcbases" $cfgfile fi # Check destination