From 295fec3e234f9596961cca411704efeb686da957 Mon Sep 17 00:00:00 2001 From: Alberto Fanjul Date: Tue, 28 Jan 2025 20:47:18 +0100 Subject: [PATCH] Fix bash conditional error when current_oc_version is empty Ensure current_oc_version is properly quoted in the if statement to prevent "unary operator expected" error when the variable is unset. --- build-patched-kao-kcmo-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-patched-kao-kcmo-images.sh b/build-patched-kao-kcmo-images.sh index 47dcd866..b802fa80 100755 --- a/build-patched-kao-kcmo-images.sh +++ b/build-patched-kao-kcmo-images.sh @@ -74,7 +74,7 @@ if [ -f "$OC" ]; then current_oc_version=$(${OC} version --client -o json |jq -r .releaseClientVersion) fi echo "OC version: ${current_oc_version-}" -if [ ${current_oc_version-} = ${OPENSHIFT_RELEASE_VERSION} ]; then +if [ "${current_oc_version-}" = "${OPENSHIFT_RELEASE_VERSION}" ]; then echo "No need to download oc, local oc is already version ${OPENSHIFT_RELEASE_VERSION}" else curl -L "${MIRROR}/${OPENSHIFT_RELEASE_VERSION}/openshift-client-linux-${OPENSHIFT_RELEASE_VERSION}.tar.gz" | tar -zx -C openshift-clients/linux oc