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/install-plugins.sh b/install-plugins.sh
index 25c12f4..db96b4b 100755
--- a/install-plugins.sh
+++ b/install-plugins.sh
@@ -12,15 +12,15 @@
 
 . /usr/local/bin/jenkins-support
 
-function getLockFile() {
-    echo -n "$REF_DIR/${1}.lock"
+getLockFile() {
+    printf '%s' "$REF_DIR/${1}.lock"
 }
 
-function getArchiveFilename() {
-    echo -n "$REF_DIR/${1}.jpi"
+getArchiveFilename() {
+    printf '%s' "$REF_DIR/${1}.jpi"
 }
 
-function download() {
+download() {
     local plugin originalPlugin version lock ignoreLockFile
     plugin="$1"
     version="${2:-latest}"
@@ -50,7 +50,7 @@
     fi
 }
 
-function doDownload() {
+doDownload() {
     local plugin version url jpi
     plugin="$1"
     version="$2"
@@ -71,7 +71,7 @@
     return $?
 }
 
-function checkIntegrity() {
+checkIntegrity() {
     local plugin jpi
     plugin="$1"
     jpi="$(getArchiveFilename "$plugin")"
@@ -80,7 +80,7 @@
     return $?
 }
 
-function resolveDependencies() {
+resolveDependencies() {
     local plugin jpi dependencies
     plugin="$1"
     jpi="$(getArchiveFilename "$plugin")"
@@ -94,7 +94,7 @@
 
     echo " > $plugin depends on $dependencies"
 
-    IFS=',' read -a array <<< "$dependencies"
+    IFS=',' read -r -a array <<< "$dependencies"
 
     for d in "${array[@]}"
     do
@@ -121,7 +121,7 @@
     wait
 }
 
-function bundledPlugins() {
+bundledPlugins() {
     local JENKINS_WAR=/usr/share/jenkins/jenkins.war
     if [ -f $JENKINS_WAR ]
     then
@@ -143,7 +143,7 @@
     fi
 }
 
-function versionFromPlugin() {
+versionFromPlugin() {
     local plugin=$1
     if [[ $plugin =~ .*:.* ]]; then
         echo "${plugin##*:}"
@@ -153,7 +153,7 @@
 
 }
 
-function installedPlugins() {
+installedPlugins() {
     for f in "$REF_DIR"/*.jpi; do
         echo "$(basename "$f" | sed -e 's/\.jpi//'):$(get_plugin_version "$f")"
     done
@@ -170,10 +170,10 @@
         mkdir "$(getLockFile "${plugin%%:*}")"
     done
 
-    echo -e "\nAnalyzing war..."
+    printf '\n%s' "Analyzing war..."
     bundledPlugins="$(bundledPlugins)"
 
-    echo -e "\nDownloading plugins..."
+    printf '\n%s' "Downloading plugins..."
     for plugin in "$@"; do
         version=""
 
@@ -194,11 +194,11 @@
     installedPlugins
 
     if [[ -f $FAILED ]]; then
-        echo -e "\nSome plugins failed to download!\n$(<"$FAILED")" >&2
+        printf '\n%s' "Some plugins failed to download!" "$(<"$FAILED")" >&2
         exit 1
     fi
 
-    echo -e "\nCleaning up locks"
+    printf '\n%s' "Cleaning up locks"
     rm -r "$REF_DIR"/*.lock
 }