diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-06-18 12:07:09 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-16 13:49:57 -0400 |
commit | 7850874b1ef1b18de585be108e3be899d95a3a2a (patch) | |
tree | 173896aa05b68545672124dbe28b098fec98ee0a /testing2x | |
parent | 282bf65c81e278b9237b4c202d325642bc0aa1a3 (diff) |
Fix quoting around variables, especially arrays.
Other than pure quoting, this involved:
- swapping */@ for array access in a few places
- fiddling with printf in a pipeline
- replacing `$(echo ${array[@]})` with `${array[*]}`
- replacing `echo $(...)` with `...`
When searching for these things, I used the command:
grep -Prn --exclude-dir=.git '(?<!["=]|\[\[ |\[\[ -[zn] )\$(?!{?#|\(|\? )'
and ignored a bunch of false positives.
Diffstat (limited to 'testing2x')
-rwxr-xr-x | testing2x | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if [ $# -lt 1 ]; then msg "usage: ${0##*/} <pkgname|pkgbase> ..." @@ -10,30 +10,30 @@ fi # Lock everything to reduce possibility of interfering task between the different repo-updates script_lock -for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 +for repo in "${TESTING_REPO}" "${STABLE_REPOS[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${pkgarch}" || exit 1 done done declare -A pkgs -for pkgbase in $*; do +for pkgbase in "$@"; do if [ ! -d "${WORKDIR}/${pkgbase}" ]; then arch_svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null found_source=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/${pkgbase}/${TESTING_REPO}-${pkgarch}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then found_source=true break fi done - ${found_source} || die "${pkgbase} not found in [${TESTING_REPO}]" + "${found_source}" || die "${pkgbase} not found in [${TESTING_REPO}]" found_target=false - for pkgarch in ${ARCHES[@]} 'any'; do - for repo in ${STABLE_REPOS[@]}; do + for pkgarch in "${ARCHES[@]}" 'any'; do + for repo in "${STABLE_REPOS[@]}"; do svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}" if [ -r "${svnrepo_to}/PKGBUILD" ]; then found_target=true @@ -42,19 +42,19 @@ for pkgbase in $*; do fi done done - ${found_target} || die "${pkgbase} not found in any of these repos: ${STABLE_REPOS[@]}" + "${found_target}" || die "${pkgbase} not found in any of these repos: ${STABLE_REPOS[*]}" fi done -for pkgarch in ${ARCHES[@]}; do - repo_unlock ${TESTING_REPO} ${pkgarch} +for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${TESTING_REPO}" "${pkgarch}" done -for repo in ${STABLE_REPOS[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} +for repo in "${STABLE_REPOS[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done if [ -n "${pkgs[${repo}]}" ]; then - "$(dirname $0)/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]} + "$(dirname "$0")/db-move" "${TESTING_REPO}" "${repo}" "${pkgs[${repo}]}" fi done |