install-operator-sdk: improve script by putting variables in quotes
protect against possible spaces in variables.
@@ -10,17 +10,17 @@ if [ -z "${OPERATOR_SDK}" ]; then
exit 1
fi
-mkdir -p $(dirname "${OPERATOR_SDK}")
-if [ -x ${OPERATOR_SDK} ]
+mkdir -p "$(dirname "${OPERATOR_SDK}")"
+if [ -x "${OPERATOR_SDK}" ]
then
- ${OPERATOR_SDK} version | grep -q "\"${OPERATOR_SDK_VERSION}\""
+ "${OPERATOR_SDK}" version | grep -q "\"${OPERATOR_SDK_VERSION}\""
if [ $? -eq 0 ]
then
exit 0
fi
fi
-PLATFORM=$(uname)
+PLATFORM="$(uname)"
if [ "${PLATFORM}" == "Darwin" ]
then
SDK_RELEASE="https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-apple-darwin"
@@ -30,10 +30,10 @@ else
fi
echo "installing version ${OPERATOR_SDK_VERSION}"
-curl -f "${SDK_RELEASE}" -Lo ${OPERATOR_SDK}
+curl -f "${SDK_RELEASE}" -Lo "${OPERATOR_SDK}"
if [ $? -ne 0 ]
then
echo "could not download and install ${SDK_RELEASE}"
exit 1
fi
-chmod +x ${OPERATOR_SDK}
+chmod +x "${OPERATOR_SDK}"
