Full best-practices / shellcheck-compliance pass
- Use modern `$()` syntax vs backticks [see [SC2006](https://github.com/koalaman/shellcheck/wiki/SC2006)]
- Always check for, and bail on, failures of `cd`. [see [SC2164](https://github.com/koalaman/shellcheck/wiki/SC2164)]
- Avoid `for foo in $(...)`, per [DontReadLinesWithFor](http://mywiki.wooledge.org/DontReadLinesWithFor)
- Avoid parsing `ls` to find subdirectories when `for d in "$dir"/*/` does the job; see also [ParsingLs](http://mywiki.wooledge.org/ParsingLs)
- `\s` is not specified in POSIX ERE (thus, not guaranteed to be available in bash-native regexes unless local platform's C library's regex implementation extends standard); use `[[:space:]]` instead.
- Avoid unnecessary deviations from POSIX sh specification:
- `echo -e` violates (not just extends) POSIX, doesn't work as expected in bash compiled with `--enable-xpg-echo-default`; [POSIX specification](http://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html) suggests `printf` as replacement (see APPLICATION USAGE section).
- `function` keyword not specified in POSIX, provides no benefit over standard-compliant syntax
diff --git a/weekly.sh b/weekly.sh
index 155a7d5..e240a8b 100755
--- a/weekly.sh
+++ b/weekly.sh
@@ -3,20 +3,20 @@
set -e
set -x
-JENKINS_VERSION=`curl -sq https://api.github.com/repos/jenkinsci/jenkins/tags | grep '"name":' | grep -o '[0-9]\.[0-9]*' | uniq | sort --version-sort | tail -1`
-echo $JENKINS_VERSION
+JENKINS_VERSION=$(curl -sq https://api.github.com/repos/jenkinsci/jenkins/tags | grep '"name":' | grep -o '[0-9]\.[0-9]*' | uniq | sort --version-sort | tail -1)
+echo "$JENKINS_VERSION"
-JENKINS_SHA=`curl http://repo.jenkins-ci.org/simple/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war.sha1`
-echo $JENKINS_SHA
+JENKINS_SHA=$(curl "http://repo.jenkins-ci.org/simple/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war.sha1")
+echo "$JENKINS_SHA"
-docker build --build-arg JENKINS_VERSION=$JENKINS_VERSION \
- --build-arg JENKINS_SHA=$JENKINS_SHA \
+docker build --build-arg "JENKINS_VERSION=$JENKINS_VERSION" \
+ --build-arg "JENKINS_SHA=$JENKINS_SHA" \
--no-cache --pull \
- --tag jenkinsci/jenkins:$JENKINS_VERSION .
+ --tag "jenkinsci/jenkins:$JENKINS_VERSION" .
-docker tag -f jenkinsci/jenkins:$JENKINS_VERSION jenkinsci/jenkins:latest
+docker tag -f "jenkinsci/jenkins:$JENKINS_VERSION" jenkinsci/jenkins:latest
-docker push jenkinsci/jenkins:$JENKINS_VERSION
+docker push "jenkinsci/jenkins:$JENKINS_VERSION"
docker push jenkinsci/jenkins:latest