diff options
author | Tom Willemse | 2021-01-18 16:58:07 -0800 |
---|---|---|
committer | Tom Willemse | 2021-01-18 16:58:07 -0800 |
commit | 3d11eda6621c8ae900d7cff3a2e5b0daa8b95bad (patch) | |
tree | 657319e1e87d781e60be5b1c351e5a3a61a776d8 /update-mirrors | |
parent | 901defa03478ee951cd4c04c0d360443e20a0b36 (diff) | |
download | update-mirrors-3d11eda6621c8ae900d7cff3a2e5b0daa8b95bad.tar.gz update-mirrors-3d11eda6621c8ae900d7cff3a2e5b0daa8b95bad.zip |
Formatting
Diffstat (limited to 'update-mirrors')
-rwxr-xr-x | update-mirrors | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/update-mirrors b/update-mirrors index 3b8a581..7e9b68c 100755 --- a/update-mirrors +++ b/update-mirrors @@ -1,25 +1,22 @@ #!/bin/bash # Functions -function fold () { /usr/bin/fold --spaces --width="$(tput cols)"; } +function fold() { /usr/bin/fold --spaces --width="$(tput cols)"; } -function _urlify-1 () -{ +function _urlify-1() { local items=($@) for item in "${items[@]:1}"; do echo "$1=${item}" done } -function urlify () -{ +function urlify() { local uitems=($(_urlify-1 "$@")) local IFS="&" echo "${uitems[*]}" } -function make-url () -{ +function make-url() { local countryparams local protocolparams local ipparams @@ -33,8 +30,7 @@ function make-url () echo "${url}/?${countryparams}&${protocolparams}&${ipparams}&${statusparams}" } -function load-global-config () -{ +function load-global-config() { local IFS=":" for dir in $1; do @@ -58,11 +54,11 @@ else fi # Check destination -if [[ ! -e "$dest" ]] && [[ ! -w "$(dirname "$dest")" ]]; then +if [[ ! -e $dest ]] && [[ ! -w "$(dirname "$dest")" ]]; then echo "Need write permission for $(dirname "$dest") to create \ ${dest}. Perhaps you should use sudo." | fold >&2 exit 1 -elif [[ -e "$dest" ]] && [[ ! -w "$dest" ]]; then +elif [[ -e $dest ]] && [[ ! -w $dest ]]; then echo "Need write permission for ${dest}, perhaps you should use \ sudo." | fold >&2 exit 1 |