[shellcheck] fix warnings (#35328) (#35366)

This commit is contained in:
Spencer 2019-04-21 11:31:15 -07:00 committed by GitHub
parent eaa739921d
commit 39f7fa7472
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -22,7 +22,7 @@ function checkout_sibling {
function clone_target_is_valid {
echo " -> checking for '${cloneBranch}' branch at ${cloneAuthor}/${project}"
if [[ -n "$(git ls-remote --heads git@github.com:${cloneAuthor}/${project}.git ${cloneBranch} 2>/dev/null)" ]]; then
if [[ -n "$(git ls-remote --heads "git@github.com:${cloneAuthor}/${project}.git" ${cloneBranch} 2>/dev/null)" ]]; then
return 0
else
return 1
@ -96,7 +96,7 @@ ES_DIR="$PARENT_DIR/elasticsearch"
ES_JAVA_PROP_PATH=$ES_DIR/.ci/java-versions.properties
if [ ! -f $ES_JAVA_PROP_PATH ]; then
if [ ! -f "$ES_JAVA_PROP_PATH" ]; then
echo "Unable to set JAVA_HOME, $ES_JAVA_PROP_PATH does not exist"
exit 1
fi
@ -104,7 +104,8 @@ fi
# While sourcing the property file would currently work, we want
# to support the case where whitespace surrounds the equals.
# This has the added benefit of explicitly exporting property values
export ES_BUILD_JAVA="$(cat "$ES_JAVA_PROP_PATH" | grep "^ES_BUILD_JAVA" | cut -d'=' -f2 | tr -d '[:space:]')"
ES_BUILD_JAVA="$(grep "^ES_BUILD_JAVA" "$ES_JAVA_PROP_PATH" | cut -d'=' -f2 | tr -d '[:space:]')"
export ES_BUILD_JAVA
if [ -z "$ES_BUILD_JAVA" ]; then
echo "Unable to set JAVA_HOME, ES_BUILD_JAVA not present in $ES_JAVA_PROP_PATH"

View file

@ -52,7 +52,7 @@ if [[ "$UNAME" = *"MINGW64_NT"* ]]; then
fi
echo " -- Running on OS: $OS"
nodeVersion="$(cat $dir/.node-version)"
nodeVersion="$(cat "$dir/.node-version")"
nodeDir="$cacheDir/node/$nodeVersion"
if [[ "$OS" == "win" ]]; then
@ -66,7 +66,7 @@ fi
echo " -- node: version=v${nodeVersion} dir=$nodeDir"
echo " -- setting up node.js"
if [ -x "$nodeBin/node" ] && [ "$($nodeBin/node --version)" == "v$nodeVersion" ]; then
if [ -x "$nodeBin/node" ] && [ "$("$nodeBin/node" --version)" == "v$nodeVersion" ]; then
echo " -- reusing node.js install"
else
if [ -d "$nodeDir" ]; then
@ -78,8 +78,8 @@ else
mkdir -p "$nodeDir"
if [[ "$OS" == "win" ]]; then
nodePkg="$nodeDir/${nodeUrl##*/}"
curl --silent -o $nodePkg $nodeUrl
unzip -qo $nodePkg -d $nodeDir
curl --silent -o "$nodePkg" "$nodeUrl"
unzip -qo "$nodePkg" -d "$nodeDir"
mv "${nodePkg%.*}" "$nodeBin"
else
curl --silent "$nodeUrl" | tar -xz -C "$nodeDir" --strip-components=1
@ -95,7 +95,7 @@ export PATH="$nodeBin:$PATH"
### downloading yarn
###
yarnVersion="$(node -e "console.log(String(require('./package.json').engines.yarn || '').replace(/^[^\d]+/,''))")"
npm install -g yarn@^${yarnVersion}
npm install -g "yarn@^${yarnVersion}"
###
### setup yarn offline cache