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 /test/test.d/db-repo-remove.sh | |
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 'test/test.d/db-repo-remove.sh')
-rwxr-xr-x | test/test.d/db-repo-remove.sh | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/test.d/db-repo-remove.sh b/test/test.d/db-repo-remove.sh index 315d63d..ce13280 100755 --- a/test/test.d/db-repo-remove.sh +++ b/test/test.d/db-repo-remove.sh @@ -1,6 +1,6 @@ #!/bin/bash -curdir=$(readlink -e $(dirname $0)) +curdir=$(readlink -e "$(dirname "$0")") . "${curdir}/../lib/common.inc" testRemovePackages() { @@ -9,23 +9,23 @@ testRemovePackages() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - releasePackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + releasePackage extra "${pkgbase}" "${arch}" done done ../db-update - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - ../db-repo-remove extra ${arch} ${pkgbase} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + ../db-repo-remove extra "${arch}" "${pkgbase}" done done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkRemovedPackageDB extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkRemovedPackageDB extra "${pkgbase}" "${arch}" done done } @@ -36,21 +36,21 @@ testRemoveMultiplePackages() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - releasePackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + releasePackage extra "${pkgbase}" "${arch}" done done ../db-update - for arch in ${arches[@]}; do - ../db-repo-remove extra ${arch} ${pkgs[@]} + for arch in "${arches[@]}"; do + ../db-repo-remove extra "${arch}" "${pkgs[@]}" done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkRemovedPackageDB extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkRemovedPackageDB extra "${pkgbase}" "${arch}" done done } |