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-add.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-add.sh')
-rwxr-xr-x | test/test.d/db-repo-add.sh | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh index 8603104..3d83007 100755 --- a/test/test.d/db-repo-add.sh +++ b/test/test.d/db-repo-add.sh @@ -1,6 +1,6 @@ #!/bin/bash -curdir=$(readlink -e $(dirname $0)) +curdir=$(readlink -e "$(dirname "$0")") . "${curdir}/../lib/common.inc" testAddSimplePackages() { @@ -9,19 +9,19 @@ testAddSimplePackages() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" - ../db-repo-add extra ${arch} ${pkgbase}-1-1-${arch}.pkg.tar.xz + ../db-repo-add extra "${arch}" "${pkgbase}-1-1-${arch}.pkg.tar.xz" done done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkPackageDB extra "${pkgbase}-1-1-${arch}.pkg.tar.xz" "${arch}" done done } @@ -32,21 +32,21 @@ testAddMultiplePackages() { local pkgbase local arch - for arch in ${arches[@]}; do + for arch in "${arches[@]}"; do add_pkgs=() - for pkgbase in ${pkgs[@]}; do + for pkgbase in "${pkgs[@]}"; do cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" - add_pkgs[${#add_pkgs[*]}]=${pkgbase}-1-1-${arch}.pkg.tar.xz + add_pkgs+=("${pkgbase}-1-1-${arch}.pkg.tar.xz") done - ../db-repo-add extra ${arch} ${add_pkgs[@]} + ../db-repo-add extra "${arch}" "${add_pkgs[@]}" done - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + checkPackageDB extra "${pkgbase}-1-1-${arch}.pkg.tar.xz" "${arch}" done done } |