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-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-remove.sh')
-rwxr-xr-x | test/test.d/db-remove.sh | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh index 416e693..fca480c 100755 --- a/test/test.d/db-remove.sh +++ b/test/test.d/db-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-remove extra ${arch} ${pkgbase} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + ../db-remove extra "${arch}" "${pkgbase}" done done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkRemovedPackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkRemovedPackage 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-remove extra ${arch} ${pkgs[@]} + for arch in "${arches[@]}"; do + ../db-remove extra "${arch}" "${pkgs[@]}" done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkRemovedPackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkRemovedPackage extra "${pkgbase}" "${arch}" done done } @@ -59,18 +59,18 @@ testRemoveAnyPackages() { local pkgs=('pkg-any-a' 'pkg-any-b') local pkgbase - for pkgbase in ${pkgs[@]}; do - releasePackage extra ${pkgbase} any + for pkgbase in "${pkgs[@]}"; do + releasePackage extra "${pkgbase}" any done ../db-update - for pkgbase in ${pkgs[@]}; do - ../db-remove extra any ${pkgbase} + for pkgbase in "${pkgs[@]}"; do + ../db-remove extra any "${pkgbase}" done - for pkgbase in ${pkgs[@]}; do - checkRemovedAnyPackage extra ${pkgbase} + for pkgbase in "${pkgs[@]}"; do + checkRemovedAnyPackage extra "${pkgbase}" done } |