Fix double quoting, suggested by shellcheck
authorAntonio Ospite <ao2@ao2.it>
Mon, 18 Dec 2017 14:54:11 +0000 (15:54 +0100)
committerAntonio Ospite <ao2@ao2.it>
Mon, 18 Dec 2017 14:56:22 +0000 (15:56 +0100)
drin.in
libexec/bootstrap.sh
libexec/clean.sh
libexec/create-profile.sh
libexec/new.sh

diff --git a/drin.in b/drin.in
index 4ba7583..b3abfae 100644 (file)
--- a/drin.in
+++ b/drin.in
@@ -18,7 +18,7 @@
 
 set -e
 
 
 set -e
 
-PROGNAME=$(basename $0)
+PROGNAME=$(basename "$0")
 LIBEXEC="@libexec@"
 
 usage() {
 LIBEXEC="@libexec@"
 
 usage() {
@@ -35,7 +35,7 @@ EOF
 
   for subcommand in ${LIBEXEC}/*.sh;
   do
 
   for subcommand in ${LIBEXEC}/*.sh;
   do
-    echo "  $(basename $subcommand .sh)"
+    echo "  $(basename "$subcommand" .sh)"
   done
 }
 
   done
 }
 
@@ -59,7 +59,7 @@ do
         exit 1
       else
         shift
         exit 1
       else
         shift
-        exec $subcommand "$@"
+        exec "$subcommand" "$@"
       fi
       ;;
   esac
       fi
       ;;
   esac
index f48e303..42911cb 100755 (executable)
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
 
 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.
 
 
 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
 # 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
 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
   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
 
   fi
 fi
 
index 34ef55e..daa86fb 100755 (executable)
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
 
 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.
 
 
 Cleanup the project, removing all the installed files.
 
@@ -51,8 +51,8 @@ echo
 read -p "Type ${CONFIRMATION_STRING} to confirm: " INPUT
 
 run() {
 read -p "Type ${CONFIRMATION_STRING} to confirm: " INPUT
 
 run() {
-  echo $*
-  $*
+  echo "$@"
+  "$@"
 }
 
 [ "$INPUT" = "$CONFIRMATION_STRING" ] && run sudo rm -rf config/ web/ vendor/ composer.lock
 }
 
 [ "$INPUT" = "$CONFIRMATION_STRING" ] && run sudo rm -rf config/ web/ vendor/ composer.lock
index 5fe572a..4ccdc9b 100755 (executable)
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
 
 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.
 
 
 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" \
   --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
 
   --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
 #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
 then
   $DRUSH default-content-export-references --folder="${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/content" node
 fi
index a73b894..2064c89 100755 (executable)
@@ -20,7 +20,7 @@ set -e
 
 usage() {
   cat <<EOF
 
 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.
 
 
 Create a new Drupal project in the 'destdir' directory.