Skip to content

Commit

Permalink
Fix bash conditional error when current_oc_version is empty
Browse files Browse the repository at this point in the history
Ensure current_oc_version is properly quoted in the if statement
to prevent "unary operator expected" error when the variable is unset.
  • Loading branch information
Alberto Fanjul authored and praveenkumar committed Jan 29, 2025
1 parent 3afaaea commit 295fec3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build-patched-kao-kcmo-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 295fec3

Please sign in to comment.