Browse Source

fix shellcheck warnings

Piotr Kwiecinski 4 years ago
parent
commit
f99f315e0f

+ 3 - 3
compose/bin/copyfromcontainer

@@ -3,13 +3,13 @@
 
 
 REAL_SRC=$(cd -P "src" && pwd)
 REAL_SRC=$(cd -P "src" && pwd)
 if [ "$1" == "--all" ]; then
 if [ "$1" == "--all" ]; then
-  docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/./ "$REAL_SRC/"
+  docker cp "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/./ "$REAL_SRC/"
   echo "Completed copying all files from container to host"
   echo "Completed copying all files from container to host"
 else
 else
   if [ -f "$1" ] ; then
   if [ -f "$1" ] ; then
-    docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/"$1" "$REAL_SRC/$1"
+    docker cp "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/"$1" "$REAL_SRC/$1"
   else
   else
-    docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/"$1" "$REAL_SRC/$(dirname "$1")"
+    docker cp "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/"$1" "$REAL_SRC/$(dirname "$1")"
   fi
   fi
   echo "Completed copying $1 from container to host"
   echo "Completed copying $1 from container to host"
 fi
 fi

+ 3 - 3
compose/bin/copytocontainer

@@ -3,15 +3,15 @@
 
 
 REAL_SRC=$(cd -P "src" && pwd)
 REAL_SRC=$(cd -P "src" && pwd)
 if [ "$1" == "--all" ]; then
 if [ "$1" == "--all" ]; then
-  docker cp "$REAL_SRC/./" $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/
+  docker cp "$REAL_SRC/./" "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/
   echo "Completed copying all files from host to container"
   echo "Completed copying all files from host to container"
   bin/fixowns
   bin/fixowns
   bin/fixperms
   bin/fixperms
 else
 else
   if [ -f "$REAL_SRC/$1" ]; then
   if [ -f "$REAL_SRC/$1" ]; then
-    docker cp "$REAL_SRC/${1}" $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/"$1"
+    docker cp "$REAL_SRC/${1}" "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/"$1"
   else
   else
-    docker cp "$REAL_SRC/${1}" $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/"$(dirname "$1")"
+    docker cp "$REAL_SRC/${1}" "$(docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/"$(dirname "$1")"
   fi
   fi
   echo "Completed copying $1 from host to container"
   echo "Completed copying $1 from host to container"
   bin/fixowns "$1"
   bin/fixowns "$1"

+ 9 - 8
compose/bin/download

@@ -1,31 +1,32 @@
 #!/bin/bash
 #!/bin/bash
+set -o errexit
 [ -z "$1" ] && echo "Please specify the version to download (ex. 2.0.0)" && exit
 [ -z "$1" ] && echo "Please specify the version to download (ex. 2.0.0)" && exit
 
 
 edition=${2:-community}
 edition=${2:-community}
 
 
 if [[ "$edition" == "enterprise" ]]; then
 if [[ "$edition" == "enterprise" ]]; then
     rm -rf src
     rm -rf src
-    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-enterprise-edition=$1 src
+    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-enterprise-edition="$1" src
     exit 0
     exit 0
 fi
 fi
 
 
-if [ ! -f ~/.docker-magento/magento2-$1.tar.gz ]; then
+if [ ! -f ~/.docker-magento/magento2-"$1".tar.gz ]; then
     mkdir -p ~/.docker-magento
     mkdir -p ~/.docker-magento
-    (cd ~/.docker-magento && curl -fOL http://pubfiles.nexcess.net/magento/ce-packages/magento2-$1.tar.gz)
+    (cd ~/.docker-magento && curl -fOL http://pubfiles.nexcess.net/magento/ce-packages/magento2-"$1".tar.gz)
 fi
 fi
 
 
 # Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
 # Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
-if [ $(find ~/.docker-magento/magento2-$1.tar.gz -size -1M) ]; then
-    (cd ~/.docker-magento && curl -o magento2-$1.tar.gz -fOL https://www.magento.mirror.hypernode.com/releases/magento-$1.tar.gz)
+if [ "$(find ~/.docker-magento/magento2-"$1".tar.gz -size -1M)" ]; then
+    (cd ~/.docker-magento && curl -o magento2-"$1".tar.gz -fOL https://www.magento.mirror.hypernode.com/releases/magento-"$1".tar.gz)
 fi
 fi
 
 
 # Final fallback. If no archive exists, let's use Composer!
 # Final fallback. If no archive exists, let's use Composer!
-if [ ! -f ~/.docker-magento/magento2-$1.tar.gz ]; then
+if [ ! -f ~/.docker-magento/magento2-"$1".tar.gz ]; then
     echo "Archive not found, or not yet available due to new version release."
     echo "Archive not found, or not yet available due to new version release."
     echo "Attempting install with Composer..."
     echo "Attempting install with Composer..."
     rm -rf src
     rm -rf src
-    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-community-edition=$1 src
+    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-community-edition="$1" src
 else
 else
     echo "Extracting magento2-$1.tar.gz to ./src"
     echo "Extracting magento2-$1.tar.gz to ./src"
-    mkdir -p src && tar xzf ~/.docker-magento/magento2-$1.tar.gz -o -C src
+    mkdir -p src && tar xzf ~/.docker-magento/magento2-"$1".tar.gz -o -C src
 fi
 fi

+ 4 - 2
compose/bin/mysql

@@ -1,9 +1,11 @@
 #!/bin/bash
 #!/bin/bash
+
+# shellcheck source=../env/db.env
 source env/db.env
 source env/db.env
 if [ -t 0 ]; then
 if [ -t 0 ]; then
   # Need tty to run mysql shell
   # Need tty to run mysql shell
-  bin/cli mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} "$@"
+  bin/cli mysql -h"${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" "$@"
 else
 else
   # Read from stdin, ex: bin/mysql < dbdump.sql
   # Read from stdin, ex: bin/mysql < dbdump.sql
-  bin/clinotty mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} "$@"
+  bin/clinotty mysql -h"${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" "$@"
 fi
 fi

+ 2 - 0
compose/bin/pwa-studio

@@ -1,4 +1,6 @@
 #!/bin/bash
 #!/bin/bash
+set -o errexit
+
 if [ ! -d pwa-studio ]; then
 if [ ! -d pwa-studio ]; then
     echo "PWA studio must first be installed by running bin/setup-pwa-studio"
     echo "PWA studio must first be installed by running bin/setup-pwa-studio"
     exit
     exit

+ 6 - 6
compose/bin/removevolumes

@@ -1,8 +1,8 @@
 #!/bin/bash
 #!/bin/bash
 current_folder=${PWD##*/}
 current_folder=${PWD##*/}
-volume_prefix=`echo $current_folder | awk '{print tolower($0)}' | sed 's/\.//g'`
-docker volume rm ${volume_prefix}_appdata
-docker volume rm ${volume_prefix}_dbdata
-docker volume rm ${volume_prefix}_rabbitmqdata
-docker volume rm ${volume_prefix}_sockdata
-docker volume rm ${volume_prefix}_ssldata
+volume_prefix=$(echo "$current_folder" | awk '{print tolower($0)}' | sed 's/\.//g')
+docker volume rm "${volume_prefix}"_appdata
+docker volume rm "${volume_prefix}"_dbdata
+docker volume rm "${volume_prefix}"_rabbitmqdata
+docker volume rm "${volume_prefix}"_sockdata
+docker volume rm "${volume_prefix}"_ssldata

+ 9 - 7
compose/bin/setup

@@ -1,5 +1,7 @@
 #!/bin/bash
 #!/bin/bash
 set -o errexit
 set -o errexit
+
+# shellcheck source=../env/db.env
 source env/db.env
 source env/db.env
 BASE_URL=${1:-magento2.test}
 BASE_URL=${1:-magento2.test}
 
 
@@ -33,12 +35,12 @@ bin/clinotty timeout 30 bash -c "
 [ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit
 [ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit
 
 
 bin/clinotty bin/magento setup:install \
 bin/clinotty bin/magento setup:install \
-  --db-host=$MYSQL_HOST \
-  --db-name=$MYSQL_DATABASE \
-  --db-user=$MYSQL_USER \
-  --db-password=$MYSQL_PASSWORD \
-  --base-url=https://$BASE_URL/ \
-  --base-url-secure=https://$BASE_URL/ \
+  --db-host="$MYSQL_HOST" \
+  --db-name="$MYSQL_DATABASE" \
+  --db-user="$MYSQL_USER" \
+  --db-password="$MYSQL_PASSWORD" \
+  --base-url=https://"$BASE_URL"/ \
+  --base-url-secure=https://"$BASE_URL"/ \
   --backend-frontname=admin \
   --backend-frontname=admin \
   --admin-firstname=John \
   --admin-firstname=John \
   --admin-lastname=Smith \
   --admin-lastname=Smith \
@@ -87,7 +89,7 @@ bin/copyfromcontainer app
 bin/copyfromcontainer vendor
 bin/copyfromcontainer vendor
 
 
 echo "Generating SSL certificate..."
 echo "Generating SSL certificate..."
-bin/setup-ssl $BASE_URL
+bin/setup-ssl "$BASE_URL"
 
 
 echo "Docker development environment setup complete."
 echo "Docker development environment setup complete."
 echo "You may now access your Magento instance at https://${BASE_URL}/"
 echo "You may now access your Magento instance at https://${BASE_URL}/"

+ 9 - 9
compose/bin/setup-composer-auth

@@ -27,14 +27,14 @@ elif [ $USE_PYTHON3 ]; then
     PY3_PASS="import sys, json; print(json.load(sys.stdin)['http-basic']['repo.magento.com']['password'])"
     PY3_PASS="import sys, json; print(json.load(sys.stdin)['http-basic']['repo.magento.com']['password'])"
 
 
     if [ -f "$GLOBAL_AUTH" ]; then
     if [ -f "$GLOBAL_AUTH" ]; then
-        PUBLIC_KEY=$(cat "$GLOBAL_AUTH" | python3 -c "$PY3_USER" 2>/dev/null)
-        PRIVATE_KEY=$(cat "$GLOBAL_AUTH" | python3 -c "$PY3_USER" 2>/dev/null)
+        PUBLIC_KEY=$(python3 -c "$PY3_USER" 2>/dev/null < "$GLOBAL_AUTH")
+        PRIVATE_KEY=$(python3 -c "$PY3_USER" 2>/dev/null < "$GLOBAL_AUTH")
     fi
     fi
 
 
     if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
     if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
         if [ -f "$PROJECT_AUTH" ]; then
         if [ -f "$PROJECT_AUTH" ]; then
-            PUBLIC_KEY=$(cat "$PROJECT_AUTH" | python3 -c "$PY3_USER" 2>/dev/null)
-            PRIVATE_KEY=$(cat "$PROJECT_AUTH" | python3 -c "$PY3_PASS" 2>/dev/null)
+            PUBLIC_KEY=$(python3 -c "$PY3_USER" 2>/dev/null < "$PROJECT_AUTH")
+            PRIVATE_KEY=$(python3 -c "$PY3_PASS" 2>/dev/null < "$PROJECT_AUTH")
             NEED_AUTH=true
             NEED_AUTH=true
         fi
         fi
     fi
     fi
@@ -49,8 +49,8 @@ if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
     exec < /dev/tty
     exec < /dev/tty
     echo
     echo
     echo "    Authentication required (repo.magento.com, public_key and private_key):"
     echo "    Authentication required (repo.magento.com, public_key and private_key):"
-    read -p "        Username: " PUBLIC_KEY
-    read -p "        Password: " PRIVATE_KEY
+    read -r -p "        Username: " PUBLIC_KEY
+    read -r -p "        Password: " PRIVATE_KEY
     echo
     echo
     exec <&-
     exec <&-
 fi
 fi
@@ -62,7 +62,7 @@ fi
 # For docker-compose.yml setting: ~/.composer:/var/www/.composer:cached
 # For docker-compose.yml setting: ~/.composer:/var/www/.composer:cached
 echo "Authentication will add to host composer global config ($GLOBAL_AUTH) for docekr container"
 echo "Authentication will add to host composer global config ($GLOBAL_AUTH) for docekr container"
 if [ $USE_COMPOSER ]; then
 if [ $USE_COMPOSER ]; then
-    composer global config http-basic.repo.magento.com $PUBLIC_KEY $PRIVATE_KEY
+    composer global config http-basic.repo.magento.com "$PUBLIC_KEY" "$PRIVATE_KEY"
 elif [ $USE_PYTHON3 ]; then
 elif [ $USE_PYTHON3 ]; then
     PY3_MERGE_AUTH="""
     PY3_MERGE_AUTH="""
 import sys, json;
 import sys, json;
@@ -89,11 +89,11 @@ def merge(src, dest):
 print(json.dumps(merge(auth, data), indent=4))
 print(json.dumps(merge(auth, data), indent=4))
 """
 """
     if [ -f "$GLOBAL_AUTH" ]; then
     if [ -f "$GLOBAL_AUTH" ]; then
-        mkdir -p $(dirname "$GLOBAL_AUTH")
+        mkdir -p "$(dirname "$GLOBAL_AUTH")"
         echo "{}" > "$GLOBAL_AUTH"
         echo "{}" > "$GLOBAL_AUTH"
     fi
     fi
     mv "$GLOBAL_AUTH" "$GLOBAL_AUTH.bak"
     mv "$GLOBAL_AUTH" "$GLOBAL_AUTH.bak"
-    cat "$GLOBAL_AUTH.bak" | python3 -c "$PY3_MERGE_AUTH" > "$GLOBAL_AUTH"
+    python3 -c "$PY3_MERGE_AUTH" > "$GLOBAL_AUTH" < "$GLOBAL_AUTH.bak"
 fi
 fi
 
 
 echo "Success to setup composer auth"
 echo "Success to setup composer auth"

+ 3 - 3
compose/bin/setup-grunt

@@ -1,11 +1,11 @@
 #!/bin/bash
 #!/bin/bash
 DEFAULT_THEME_ID="select value from core_config_data where path = 'design/theme/theme_id'"
 DEFAULT_THEME_ID="select value from core_config_data where path = 'design/theme/theme_id'"
 THEME_PATH="select theme_path from theme where theme_id in ($DEFAULT_THEME_ID);"
 THEME_PATH="select theme_path from theme where theme_id in ($DEFAULT_THEME_ID);"
-VENDOR_THEME=`bin/n98-magerun2 db:query "$THEME_PATH" | sed -n 2p | cut -d$'\r' -f1`
-THEME=`echo $VENDOR_THEME | cut -d'/' -f2`
+VENDOR_THEME=$(bin/n98-magerun2 db:query "$THEME_PATH" | sed -n 2p | cut -d$'\r' -f1)
+THEME=$(echo "$VENDOR_THEME" | cut -d'/' -f2)
 
 
 # Generate local-theme.js for custom theme
 # Generate local-theme.js for custom theme
-read -d '' GEN_THEME_JS << EOM
+read -r -d '' GEN_THEME_JS << EOM
 var fs = require('fs');
 var fs = require('fs');
 var util = require('util');
 var util = require('util');
 var theme = require('./dev/tools/grunt/configs/themes');
 var theme = require('./dev/tools/grunt/configs/themes');

+ 5 - 3
compose/bin/setup-integration-tests

@@ -1,13 +1,15 @@
 #!/bin/bash
 #!/bin/bash
+
+# shellcheck source=../env/db.env
 source env/db.env
 source env/db.env
 
 
 MYSQL_INTEGRATION_CONFIG=dev/tests/integration/etc/install-config-mysql.php
 MYSQL_INTEGRATION_CONFIG=dev/tests/integration/etc/install-config-mysql.php
 
 
 # If database doesn't exist create it and add user permissions
 # If database doesn't exist create it and add user permissions
-bin/clinotty mysql -h${MYSQL_INTEGRATION_HOST} -uroot -p${MYSQL_ROOT_PASSWORD} ${MYSQL_INTEGRATION_DATABASE} -e exit &> /dev/null || 
-  bin/clinotty mysqladmin -h${MYSQL_INTEGRATION_HOST} -uroot -p${MYSQL_ROOT_PASSWORD} create ${MYSQL_INTEGRATION_DATABASE} &&
+bin/clinotty mysql -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD}" "${MYSQL_INTEGRATION_DATABASE}" -e exit &> /dev/null ||
+  bin/clinotty mysqladmin -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD}" create "${MYSQL_INTEGRATION_DATABASE}" &&
   echo "Database ${MYSQL_INTEGRATION_DATABASE} created." &&
   echo "Database ${MYSQL_INTEGRATION_DATABASE} created." &&
-  bin/cli mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h${MYSQL_INTEGRATION_HOST} \
+  bin/cli mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" -h"${MYSQL_INTEGRATION_HOST}" \
     -e "GRANT ALL PRIVILEGES ON ${MYSQL_INTEGRATION_DATABASE}.* TO '${MYSQL_INTEGRATION_USER}'@'%';FLUSH PRIVILEGES;"
     -e "GRANT ALL PRIVILEGES ON ${MYSQL_INTEGRATION_DATABASE}.* TO '${MYSQL_INTEGRATION_USER}'@'%';FLUSH PRIVILEGES;"
 
 
 sed -e "s/'db-host' => 'localhost'/'db-host' => '${MYSQL_INTEGRATION_HOST}'/" \
 sed -e "s/'db-host' => 'localhost'/'db-host' => '${MYSQL_INTEGRATION_HOST}'/" \

+ 1 - 0
compose/bin/setup-pwa-studio

@@ -1,4 +1,5 @@
 #!/bin/bash
 #!/bin/bash
+set -o errexit
 echo "Install NodeJS and Yarn on host machine, otherwise setup will fail"
 echo "Install NodeJS and Yarn on host machine, otherwise setup will fail"
 
 
 BASE_URL=${1:-master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud}
 BASE_URL=${1:-master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud}

+ 1 - 1
compose/bin/setup-ssl-ca

@@ -3,7 +3,7 @@ set -o errexit
 # Generate a new local CA "/root/.local/share/mkcert"
 # Generate a new local CA "/root/.local/share/mkcert"
 docker-compose exec -T -u root app mkcert -install
 docker-compose exec -T -u root app mkcert -install
 
 
-docker cp $(docker-compose ps -q app|awk '{print $1}'):/root/.local/share/mkcert/rootCA.pem .
+docker cp "$(docker-compose ps -q app|awk '{print $1}')":/root/.local/share/mkcert/rootCA.pem .
 echo "System password requested to install certificate authority on host..."
 echo "System password requested to install certificate authority on host..."
 
 
 if [ "$(uname)" == "Darwin" ]; then
 if [ "$(uname)" == "Darwin" ]; then

+ 13 - 8
compose/bin/start

@@ -3,24 +3,29 @@ set -o errexit
 
 
 # Ref: https://stackoverflow.com/a/51789677/9821321
 # Ref: https://stackoverflow.com/a/51789677/9821321
 function parseYaml {
 function parseYaml {
-  local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
+  local s
+  local w
+  local fs
+  s='[[:space:]]*'
+  w='[a-zA-Z0-9_]*'
+  fs=$(echo @|tr @ '\034')
   sed -ne "s|,$s\]$s\$|]|" \
   sed -ne "s|,$s\]$s\$|]|" \
-      -e "s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s\]|\1\2:\n\1  - \3|;p" $1 | \
+      -e "s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s\]|\1\2:\n\1  - \3|;p" "$1" | \
   sed -ne "s|,$s}$s\$|}|" \
   sed -ne "s|,$s}$s\$|}|" \
       -e "s|^\($s\)-$s{$s\(.*\)$s}|\1-\n\1  \2|;p" | \
       -e "s|^\($s\)-$s{$s\(.*\)$s}|\1-\n\1  \2|;p" | \
   sed -ne "s|^\($s\):|\1|" \
   sed -ne "s|^\($s\):|\1|" \
-      -e "s|^\($s\)-$s[\"']\(.*\)[\"']$s\$|\1$fs$fs\2|p" \
+      -e "s|^\($s\)-$s{[\"']\(.*\)[\"']}$s\$|\1$fs$fs\2|p" \
       -e "s|^\($s\)-$s\(.*\)$s\$|\1$fs$fs\2|p" \
       -e "s|^\($s\)-$s\(.*\)$s\$|\1$fs$fs\2|p" \
-      -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
+      -e "s|^\($s\)\($w\)$s:$s{[\"']\(.*\)[\"']}$s\$|\1$fs\2$fs\3|p" \
       -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" | \
       -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" | \
-  awk -F$fs '{
+  awk -F"$fs" '{
     indent = length($1)/2;
     indent = length($1)/2;
     vname[indent] = $2;
     vname[indent] = $2;
     for (i in vname) {if (i > indent) {delete vname[i]; idx[i]=0}}
     for (i in vname) {if (i > indent) {delete vname[i]; idx[i]=0}}
     if (length($2) == 0) {vname[indent] = ++idx[indent] };
     if (length($2) == 0) {vname[indent] = ++idx[indent] };
     if (length($3) > 0) {
     if (length($3) > 0) {
       vn=""; for (i=0; i<indent; i++) {vn = (vn)(vname[i])("_")}
       vn=""; for (i=0; i<indent; i++) {vn = (vn)(vname[i])("_")}
-      if ("'$2'_" == vn) {
+      if ("'"$2"'_" == vn) {
          print substr($3 ,1 , match($3,":")-1)
          print substr($3 ,1 , match($3,":")-1)
       }
       }
     }
     }
@@ -28,12 +33,12 @@ function parseYaml {
 }
 }
 
 
 # Check if volume files exist to avoid creating an empty folder
 # Check if volume files exist to avoid creating an empty folder
-VOLUME_LIST=`parseYaml docker-compose.dev.yml services_app_volumes`
+VOLUME_LIST=$(parseYaml docker-compose.dev.yml services_app_volumes)
 IGNORE_LIST="./src/app/code ./src/m2-hotfixes ./src/patches ./src/var/log ./src/var/report ./src"
 IGNORE_LIST="./src/app/code ./src/m2-hotfixes ./src/patches ./src/var/log ./src/var/report ./src"
 IS_VALID=true
 IS_VALID=true
 # Loop through all files missing from the docker-compose.dev.yml file
 # Loop through all files missing from the docker-compose.dev.yml file
 for file in $VOLUME_LIST; do
 for file in $VOLUME_LIST; do
-  if [ ! -e $file ] && [[ ! " $IGNORE_LIST " =~ " $file " ]]; then
+  if [ ! -e "$file" ] && [[ ! " $IGNORE_LIST " =~ $file ]]; then
     echo "$file: No such file or directory"
     echo "$file: No such file or directory"
     IS_VALID=false
     IS_VALID=false
   fi
   fi

+ 2 - 1
compose/bin/update

@@ -1,5 +1,6 @@
 #!/bin/bash
 #!/bin/bash
-mkdir -p tmpupdate && cd $_
+set -o errexit
+mkdir -p tmpupdate && cd "$_"
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
 rm -rf .git
 rm -rf .git
 rsync -av ./ ../
 rsync -av ./ ../

+ 1 - 1
compose/bin/xdebug

@@ -40,7 +40,7 @@ xdebug_disable() {
     fi
     fi
 }
 }
 
 
-firstArgLetter="$(echo $1 | head -c 1)"
+firstArgLetter="$(echo "$1" | head -c 1)"
 
 
 if [[ $firstArgLetter == "d" ]]; then
 if [[ $firstArgLetter == "d" ]]; then
     xdebug_disable
     xdebug_disable