From 50b546739d6ba90d12b21700dcd02cebc07f0b7f Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Mon, 18 Dec 2017 15:54:11 +0100
Subject: [PATCH] Fix double quoting, suggested by shellcheck

---
 drin.in                   | 6 +++---
 libexec/bootstrap.sh      | 8 ++++----
 libexec/clean.sh          | 6 +++---
 libexec/create-profile.sh | 8 ++++----
 libexec/new.sh            | 2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drin.in b/drin.in
index 4ba7583..b3abfae 100644
--- a/drin.in
+++ b/drin.in
@@ -18,7 +18,7 @@
 
 set -e
 
-PROGNAME=$(basename $0)
+PROGNAME=$(basename "$0")
 LIBEXEC="@libexec@"
 
 usage() {
@@ -35,7 +35,7 @@ EOF
 
   for subcommand in ${LIBEXEC}/*.sh;
   do
-    echo "  $(basename $subcommand .sh)"
+    echo "  $(basename "$subcommand" .sh)"
   done
 }
 
@@ -59,7 +59,7 @@ do
         exit 1
       else
         shift
-        exec $subcommand "$@"
+        exec "$subcommand" "$@"
       fi
       ;;
   esac
diff --git a/libexec/bootstrap.sh b/libexec/bootstrap.sh
index f48e303..42911cb 100755
--- a/libexec/bootstrap.sh
+++ b/libexec/bootstrap.sh
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
-usage: drin $(basename $0 .sh) [--devel|-h|--help]
+usage: drin $(basename "$0" .sh) [--devel|-h|--help]
 
 Bootstrap a Drupal project, using settings from a 'bootstrap.conf' file.
 
@@ -94,15 +94,15 @@ DRUPAL_CONSOLE="${PWD}/vendor/bin/drupal"
 # This becomes unnecessary if the installation profile gets pulled in by
 # composer.json, like suggested in
 # https://github.com/drupal-composer/drupal-project/issues/249
-if ! echo $INSTALLATION_PROFILE | egrep -q "^(minimal|standard)$";
+if ! echo "$INSTALLATION_PROFILE" | egrep -q "^(minimal|standard)$";
 then
-  if [ -d $SITE_LOCAL_PATH/profiles/$INSTALLATION_PROFILE -a "$OVERWRITE_PROFILE" != "true" ];
+  if [ -d "${SITE_LOCAL_PATH}/profiles/${INSTALLATION_PROFILE}" -a "$OVERWRITE_PROFILE" != "true" ];
   then
     echo "Installation profile '$INSTALLATION_PROFILE' already there." 1>&2
     echo "Use --overwrite-profile to copy over it." 1>&2
     exit 1
   else
-    cp -a $INSTALLATION_PROFILE $SITE_LOCAL_PATH/profiles
+    cp -a "$INSTALLATION_PROFILE" "${SITE_LOCAL_PATH}/profiles"
   fi
 fi
 
diff --git a/libexec/clean.sh b/libexec/clean.sh
index 34ef55e..daa86fb 100755
--- a/libexec/clean.sh
+++ b/libexec/clean.sh
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
-usage: drin $(basename $0 .sh) [-h|--help]
+usage: drin $(basename "$0" .sh) [-h|--help]
 
 Cleanup the project, removing all the installed files.
 
@@ -51,8 +51,8 @@ echo
 read -p "Type ${CONFIRMATION_STRING} to confirm: " INPUT
 
 run() {
-  echo $*
-  $*
+  echo "$@"
+  "$@"
 }
 
 [ "$INPUT" = "$CONFIRMATION_STRING" ] && run sudo rm -rf config/ web/ vendor/ composer.lock
diff --git a/libexec/create-profile.sh b/libexec/create-profile.sh
index 5fe572a..4ccdc9b 100755
--- a/libexec/create-profile.sh
+++ b/libexec/create-profile.sh
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
-usage: drin $(basename $0 .sh) [-h|--help] <title> <machine_name>
+usage: drin $(basename "$0" .sh) [-h|--help] <title> <machine_name>
 
 Create an installation profile from the installed project.
 
@@ -88,8 +88,8 @@ $DRUPAL_CONSOLE generate:profile \
   --profile="$PROFILE_TITLE" \
   --machine-name="$PROFILE_MACHINE_NAME" \
   --description="Drupal installation profile for $PROFILE_TITLE" \
-  --dependencies=$ENABLED_MODULES \
-  --themes=$ENABLED_THEMES \
+  --dependencies="$ENABLED_MODULES" \
+  --themes="$ENABLED_THEMES" \
   --profile-path="$PROJECT_ROOT" \
   --no-interaction
 
@@ -107,7 +107,7 @@ find "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install" -type f -exec sed
 #fdupes -f -1 "${WEB_ROOT}/core/profiles/standard/config/install/" "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install/" | xargs rm
 
 # Export the default content if the default_content module is there
-if echo $ENABLED_MODULES | grep -q default_content;
+if echo "$ENABLED_MODULES" | grep -q default_content;
 then
   $DRUSH default-content-export-references --folder="${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/content" node
 fi
diff --git a/libexec/new.sh b/libexec/new.sh
index a73b894..2064c89 100755
--- a/libexec/new.sh
+++ b/libexec/new.sh
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
-usage: drin $(basename $0 .sh) [-h|--help] <destdir>
+usage: drin $(basename "$0" .sh) [-h|--help] <destdir>
 
 Create a new Drupal project in the 'destdir' directory.
 
-- 
2.1.4