From cf6cc693aa54c39c10c71a547187c89ab518564a Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Fri, 9 Jul 2021 10:05:51 -0500 Subject: [PATCH] setup: quote variables in checks Without "" around the variable, if they are unset, no string is visible to bash and the test incorrectly passes. --- setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup b/setup index 5cd1911..949cca2 100755 --- a/setup +++ b/setup @@ -48,8 +48,8 @@ initial_settings_yml() { fi } -[ -n ${template} ] || usage "ERROR: Missing pipeline template type" 1 -[ -d ${target} ] || usage "ERROR: ${target} path not found" 1 +[ -n "${template}" ] || usage "ERROR: Missing pipeline template type" 1 +[ -d "${target}" ] || usage "ERROR: ${target} path not found" 1 pattern="^($(echo "$pipeline_types" | tr "\n" "|" | sed -e "s/\|*$//"))$" [[ "${template}"=~$pattern ]] || usage "ERROR: ${template} is not a valid pipeline template" 1