From cbe094073500c7bfdcc4131d676e9efe265f9024 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 4 Aug 2020 12:25:53 -0700 Subject: [PATCH] Fix shellcheck errors in scripts Change-Id: I8ffc8ac98bc128f54aa515153615c8aa10560316 Signed-off-by: Eric Ball --- ensure-documented.sh | 2 +- releasenotes/notes/fix-shellcheck-errors-9aa83f7c21d16ee9.yaml | 4 ++++ shell/jjb-verify-job.sh | 6 +++--- shell/license-check.sh | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/fix-shellcheck-errors-9aa83f7c21d16ee9.yaml diff --git a/ensure-documented.sh b/ensure-documented.sh index b24e40c8..823a542a 100755 --- a/ensure-documented.sh +++ b/ensure-documented.sh @@ -35,7 +35,7 @@ for file in "${jjb_files[@]}"; do done done -if [ $undocumented_count -gt 0 ]; then +if [ "$undocumented_count" -gt 0 ]; then echo "Number of undocumented items: $undocumented_count" exit 1 fi diff --git a/releasenotes/notes/fix-shellcheck-errors-9aa83f7c21d16ee9.yaml b/releasenotes/notes/fix-shellcheck-errors-9aa83f7c21d16ee9.yaml new file mode 100644 index 00000000..a458ef18 --- /dev/null +++ b/releasenotes/notes/fix-shellcheck-errors-9aa83f7c21d16ee9.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Minor fixes to correct shellcheck warnings/errors. diff --git a/shell/jjb-verify-job.sh b/shell/jjb-verify-job.sh index 5ed12e2a..7d679bd1 100644 --- a/shell/jjb-verify-job.sh +++ b/shell/jjb-verify-job.sh @@ -29,10 +29,10 @@ set +f # Directories beginning with {0..9} or {A..Z} are left at the top level. ( cd archives/job-configs for letter in {a..z}; do - if ls -d $letter* > /dev/null 2>&1; then + if ls -d "$letter"* > /dev/null 2>&1; then mkdir .tmp - mv $letter* .tmp - mv .tmp $letter + mv "$letter"* .tmp + mv .tmp "$letter" fi done ) diff --git a/shell/license-check.sh b/shell/license-check.sh index 8466cf99..5b430723 100644 --- a/shell/license-check.sh +++ b/shell/license-check.sh @@ -56,7 +56,7 @@ fi set -f # Disable globbing for $file_patterns to pass '*' # Purposely disable SC2068 for $file_patterns # shellcheck disable=SC2068 -lhc --license "$licenses_allowed" ${disable_spdx} \ +lhc --license "$licenses_allowed" "${disable_spdx}" \ --exclude "$license_exclude_paths" \ ${file_patterns[@]} set +f -- 2.16.6