diff --git a/bin/foamCleanPath b/bin/foamCleanPath
index 5d197ac0b10f2803e8fe090923fcc935ddb63a3a..f54575a8d99ba9e7de0cebc6534d4f7d8d98ecac 100755
--- a/bin/foamCleanPath
+++ b/bin/foamCleanPath
@@ -14,20 +14,19 @@
 #     foamCleanPath
 #
 # Description
-#     Usage: foamCleanPath [OPTION] path [wildcard] .. [wildcard]
-#            foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
+#     Usage: foamCleanPath [OPTION] path [filter] .. [filter]
+#            foamCleanPath [OPTION] -env=name [filter] .. [filter]
 #
 #     Prints its argument (which should be a ':' separated path)
 #     without the following:
 #         - duplicate elements
-#         - elements whose start matches a wildcard
+#         - elements matching the specified filter(s)
 #         - inaccessible directories (with the -strip option)
 #
 # Note
-#     - this routine fails when directories have embedded spaces
-#     - false matches possible if a wildcard contains '.' (sed regex)
-#     - the wildcards themselves can be written together and separated
-#       by colons or whitespace
+#     - false matches possible when the filter contains '.' (sed regex) etc.
+#     - a single composite filter can be passed in. This composite filter
+#       is assumed to be delimited by whitespace, colons or semi-colons.
 #
 # Examples for cleaning the path:
 #
@@ -38,9 +37,9 @@
 #       cleaned=$(foamCleanPath -env=PATH dir1:dir2) && PATH=$cleaned
 #
 #     - Using shell evaluation for the output
-#       eval $(foamCleanPath -sh=PATH "$PATH" dir1:dir2)
-#       eval $(foamCleanPath -sh=PATH -env=PATH dir1:dir2)
-#       eval $(foamCleanPath -sh-env=PATH dir1:dir2)
+#       eval $(foamCleanPath -sh=PATH $PATH" dir1:dir2)
+#       eval "$(foamCleanPath -sh=PATH -env=PATH dir1:dir2)"
+#       eval "$(foamCleanPath -sh-env=PATH dir1:dir2)"
 #
 #     - Similarly for c-shell
 #       eval `foamCleanPath -csh-env=PATH dir1:dir2`
@@ -48,28 +47,27 @@
 #------------------------------------------------------------------------------
 usage() {
     cat <<USAGE 1>&2
-Usage: foamCleanPath [OPTION] path [wildcard1] .. [wildcardN]]
-       foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
-
+Usage: foamCleanPath [OPTION] path [filter] .. [filter]
+       foamCleanPath [OPTION] -env=name [filter] .. [filter]
 options:
   -csh=NAME         Produce 'setenv NAME ...' output for csh eval
   -sh=NAME          Produce 'NAME=...' output for sh eval
   -csh-env=NAME     As per -csh, with -env for initial content
   -sh-env=NAME      As per -sh,  with -env for initial content
   -env=NAME         Evaluate NAME to obtain initial content
-  -debug            print debug information to stderr
-  -strip            remove inaccessible directories
-  -verbose          report some progress (input, output, ...)
-  -help             print the usage
+  -debug            Print debug information to stderr
+  -strip            Remove inaccessible directories
+  -verbose          Report some progress (input, output, ...)
+  -help             Print the usage
 
 Prints its argument (which should be a ':' separated list) cleansed from
   * duplicate elements
-  * elements whose start matches one of the wildcard(s)
+  * elements whose start matches one of the filters
   * inaccessible directories (the -strip option)
 
 Exit status
     0  on success
-    1  for miscellaneous errors.
+    1  general error
     2  initial value of 'path' is empty
 
 USAGE
@@ -169,19 +167,20 @@ else
     printDebug() { true; }      # No-op
 fi
 
-# Check directory existence (optional)
+# Optional test for directory existence
 if [ -n "$optStrip" ]
 then
-    isDir() { test -d "$1"; }   # Check for directory
+    isDir() { test -d "$1"; }   # Check for directory existence
 else
-    isDir() { true; }           # No check (always true)
+    isDir() { test -n "$1"; }   # Only check for non-zero string
 fi
 
-# The "wildcard1 ... wildcardN" may have been passed as a single parameter
-# or may contain ':' separators
+# The "filter ... filterN" may have been passed as a single parameter
+# or may contain ':' separators.
+# Currently (OCT-2018) also accept split on whitespace too.
 
 oldIFS="$IFS"       # Preserve initial IFS
-IFS=':; '           # Split on colon, whitespace (semi-colon for good measure)
+IFS=':; '           # Split on colon, semicolon, whitespace
 set -- $*
 
 if [ -n "$optVerbose" ]
@@ -192,22 +191,20 @@ fi
 
 printDebug "input>$dirList<"
 
-# Strip out wildcards via sed. Path and wildcard cannot contain '?'.
-for wildcard
+# Apply filters via sed. Path and filter cannot contain '?'.
+for filter
 do
-    if [ -n "$wildcard" ]
+    if [ -n "$filter" ]
     then
-        printDebug "remove>$wildcard<"
-        dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g")
+        printDebug "remove>$filter<"
+        dirList=$(echo "$dirList:" | sed -e "s?${filter}[^:]*:??g")
     fi
 done
 printDebug "intermediate>$dirList<"
 
-IFS=':; '           # Split on colon, whitespace (semi-colon for good measure)
+IFS=':'             # Split on colon. No split on whitespace.
 set -- $dirList
 
-IFS="$oldIFS"       # Restore initial IFS
-
 # Rebuild the list
 unset dirList
 for dir
@@ -227,12 +224,14 @@ do
     fi
 done
 
+IFS="$oldIFS"       # Restore initial IFS
+
 printDebug "output>$dirList<"
 if [ -n "$optVerbose" ]
 then
-    echo "output: $dirList" 1>&2
+    echo "output: \"$dirList\"" 1>&2
 fi
 
-echo "$shellOutput$dirList"
+echo "$shellOutput\"$dirList\""
 
 #------------------------------------------------------------------------------
diff --git a/etc/bashrc b/etc/bashrc
index f076066796e38214da622d93f505bb2bb8a33057..7340532d7e468d2e286ef49edc0abceec8f47c25 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -47,10 +47,10 @@ export WM_PROJECT_VERSION=plus
 #    set one of the fallback values to an appropriate path.
 # --
 rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
-[ -n "$rc" ] && FOAM_INST_DIR=$(\cd $(dirname $rc)/../.. && \pwd -L) || \
-FOAM_INST_DIR=$HOME/$WM_PROJECT
-# FOAM_INST_DIR=/opt/$WM_PROJECT
-# FOAM_INST_DIR=/usr/local/$WM_PROJECT
+[ -n "$rc" ] && FOAM_INST_DIR="$(\cd $(dirname $rc)/../.. && \pwd -L)" || \
+FOAM_INST_DIR="$HOME/$WM_PROJECT"
+# FOAM_INST_DIR="/opt/$WM_PROJECT"
+# FOAM_INST_DIR="/usr/local/$WM_PROJECT"
 #
 # END OF (NORMAL) USER EDITABLE PART
 ################################################################################
@@ -153,7 +153,7 @@ then
     unset FOAM_SETTINGS
 else
     export FOAM_SETTINGS
-    _foamEval $@
+    _foamEval "$@"
 fi
 
 # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
@@ -170,7 +170,7 @@ _foamEtc -config  settings
 # Setup for third-party packages
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 _foamEtc -config  mpi
-_foamEtc -config  paraview -- $@        # Pass through for evaluation
+_foamEtc -config  paraview -- "$@"  # Pass through for evaluation
 _foamEtc -config  vtk
 _foamEtc -config  ensight
 _foamEtc -config  gperftools
diff --git a/etc/config.sh/ADIOS b/etc/config.sh/ADIOS
index 54534209ddf4fc32d2908753f9a834cfc78df036..df1fec50e2367ec4f9c2446e81a95730eb269bd3 100644
--- a/etc/config.sh/ADIOS
+++ b/etc/config.sh/ADIOS
@@ -37,7 +37,7 @@ export ADIOS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using adios ($adios_version)  ->  $ADIOS_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/ADIOS2 b/etc/config.sh/ADIOS2
index b77593e9a59f4a2c3d3556c76fd152c31645f71b..3719333378fefdaea6688d37f8988aa580a24fbf 100644
--- a/etc/config.sh/ADIOS2
+++ b/etc/config.sh/ADIOS2
@@ -25,7 +25,7 @@ export ADIOS2_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adio
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using adios ($adios2_version)  ->  $ADIOS2_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/CGAL b/etc/config.sh/CGAL
index 9acf55892b2f0d083ab0cbe75ccdc3fe235a7aac..1e5558017b0b7386a923d427027db92fb6243b59 100644
--- a/etc/config.sh/CGAL
+++ b/etc/config.sh/CGAL
@@ -49,7 +49,7 @@ export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_v
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using boost ($boost_version)  ->  $BOOST_ARCH_PATH" 1>&2
     echo "Using CGAL ($cgal_version)  ->  $CGAL_ARCH_PATH" 1>&2
diff --git a/etc/config.sh/FFTW b/etc/config.sh/FFTW
index f20d2b5421cf657afe277451a69ef88d0fe5d3ae..f273b642674a73fb2b0f3e1c266c29eee3cd4f6e 100644
--- a/etc/config.sh/FFTW
+++ b/etc/config.sh/FFTW
@@ -38,7 +38,7 @@ export FFTW_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_v
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using fftw ($fftw_version)  ->  $FFTW_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/aliases b/etc/config.sh/aliases
index 2a5c5790642871914d971350d795309d35c38b44..a0a54de3114cf2157fd36d2589e1d4cfd83e457a 100644
--- a/etc/config.sh/aliases
+++ b/etc/config.sh/aliases
@@ -58,10 +58,10 @@ alias uutil='cd $WM_PROJECT_USER_DIR/applications/utilities'
 unset -f wmRefresh 2>/dev/null
 wmRefresh()
 {
-    local projectDir=$WM_PROJECT_DIR
-    local foamSettings=$FOAM_SETTINGS
+    local projectDir="$WM_PROJECT_DIR"
+    local foamSettings="$FOAM_SETTINGS"
     wmUnset
-    . $projectDir/etc/bashrc $foamSettings
+    . "$projectDir/etc/bashrc" "$foamSettings"
 }
 
 
@@ -73,13 +73,13 @@ foamVersion()
     if [ "$#" -gt 0 ]
     then
         local dir="${WM_PROJECT_DIR%/*}"    # Parent directory
-        local ver=$1
+        local ver="$1"
         shift
 
         if [ -f "$dir/OpenFOAM-$ver/etc/bashrc" ]
         then
             wmUnset
-            . $dir/OpenFOAM-$ver/etc/bashrc
+            . "$dir/OpenFOAM-$ver/etc/bashrc"
             foam
             echo "Changed to OpenFOAM-$WM_PROJECT_VERSION" 1>&2
         else
@@ -104,7 +104,7 @@ foamVersion()
 unset -f foamPV 2>/dev/null
 foamPV()
 {
-    . $WM_PROJECT_DIR/etc/config.sh/paraview "${@+ParaView_VERSION=$@}"
+    . "$WM_PROJECT_DIR/etc/config.sh/paraview" "${@+ParaView_VERSION=$@}"
     local pvdir="${ParaView_DIR##*/}"
     echo "${pvdir:-ParaView_DIR not set}" 1>&2
 }
@@ -117,13 +117,13 @@ foamPwd()
 {
     if [ -d "$WM_PROJECT_DIR" ]
     then
-        echo $PWD | sed \
+        echo "$PWD" | sed \
         -e "s#^${FOAM_RUN}#\$FOAM_RUN#;" \
         -e "s#^${WM_PROJECT_DIR}#\$WM_PROJECT_DIR#;" \
         -e "s#^${WM_PROJECT_USER_DIR}#\$WM_PROJECT_USER_DIR#;" \
         -e "s#^${HOME}#\$HOME#";
     else
-        echo $PWD | sed -e "s#^${HOME}#\$HOME#;"
+        echo "$PWD" | sed -e "s#^${HOME}#\$HOME#;"
     fi
 }
 
diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion
index d2ea0b0315f6171ac808696f408020607bb47d82..98c3556b20685a5c529901447d2163c6a1396c08 100644
--- a/etc/config.sh/bash_completion
+++ b/etc/config.sh/bash_completion
@@ -37,7 +37,7 @@ then
     foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
     for cleaned in $foamOldDirs
     do
-        complete -r $cleaned 2>/dev/null
+        complete -r "$cleaned" 2>/dev/null
     done
 fi
 
diff --git a/etc/config.sh/example/paraview b/etc/config.sh/example/paraview
index fb91cc1699a7e6824f929419531d899e256947d8..ced794a3f3b41b4826110280e7405e633cbcda7c 100644
--- a/etc/config.sh/example/paraview
+++ b/etc/config.sh/example/paraview
@@ -27,6 +27,8 @@ pv=5.5.0
 pv=5.5.0-mpipy
 qt=qt-5.9.0
 
-eval $(foamEtcFile -sh -config -mode=o paraview -- ParaView_VERSION=$pv ParaView_QT=$qt)
+eval \
+    "$(foamEtcFile -sh -config -mode=o paraview -- \
+    ParaView_VERSION=$pv ParaView_QT=$qt)"
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index 39afd27bd8dbdd18431a03dc001a61e0f0a153b8..cd4f9d255044a695e364e257a6f370f526c86d1f 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -28,22 +28,22 @@ then
     WM_SHELL_FUNCTIONS=loaded
 
     # Cleaning environment variables
-    foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
+    foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
 
     # Cleaning environment variables
     unset -f _foamClean 2>/dev/null
     _foamClean()
     {
-         foamVar_name=$1
+         foamVar_name="$1"
          shift
-         eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$foamVar_name "$@")
-         unset foamVar_name
+         eval "$($foamClean -sh-env=$foamVar_name $@)"
+         unset "foamVar_name"
     }
 
     # Source an etc file, possibly with some verbosity
     # - use eval to avoid intermediate variables (ksh doesn't have 'local')
     unset -f _foamEtc 2>/dev/null
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         _foamEtc()
         {
@@ -60,21 +60,21 @@ then
     unset -f _foamAddPath 2>/dev/null
     _foamAddPath()
     {
-        [ -n "$1" ] && export PATH=$1:$PATH
+        [ -n "$1" ] && export PATH="$1:$PATH"
     }
 
     # Prepend MANPATH
     unset -f _foamAddMan 2>/dev/null
     _foamAddMan()
     {
-        [ -n "$1" ] && export MANPATH=$1:$MANPATH
+        [ -n "$1" ] && export MANPATH="$1:$MANPATH"
     }
 
     # Prepend LD_LIBRARY_PATH
     unset -f _foamAddLib 2>/dev/null
     _foamAddLib()
     {
-        [ -n "$1" ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
+        [ -n "$1" ] && export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
     }
 
     # Prepend to LD_LIBRARY_PATH with additional checking
@@ -106,7 +106,7 @@ then
             do
                 if [ -d "$foamVar_prefix/$foamVar_end" ]
                 then
-                    export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
+                    export LD_LIBRARY_PATH="$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH"
                     unset foamVar_prefix foamVar_end
                     return 0
                 fi
@@ -119,10 +119,10 @@ then
         then
             case "$foamVar_end" in
             /*)     # An absolute path
-                export LD_LIBRARY_PATH=$foamVar_end:$LD_LIBRARY_PATH
+                export LD_LIBRARY_PATH="$foamVar_end:$LD_LIBRARY_PATH"
                 ;;
             (*)     # Relative to prefix
-                export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
+                export LD_LIBRARY_PATH="$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH"
                 ;;
             esac
             unset foamVar_prefix foamVar_end
@@ -143,7 +143,7 @@ then
         # Prepend DYLD_LIBRARY_PATH
         _foamAddLib()
         {
-            [ -n "$1" ] && export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
+            [ -n "$1" ] && export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH"
         }
 
         # Prepend to DYLD_LIBRARY_PATH with additional checking
@@ -168,19 +168,22 @@ then
                 ;;
             *=)
                 # name=       -> unset name
-                [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}" 1>&2
+                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                    && echo "unset ${1%=}" 1>&2
                 eval "unset ${1%=}"
                 ;;
             *=*)
                 # name=value  -> export name=value
-                [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" 1>&2
+                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                    && echo "export $1" 1>&2
                 eval "export $1"
                 ;;
             *)
                 # Filename: source it
                 if [ -f "$1" ]
                 then
-                    [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Using: $1" 1>&2
+                    [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                        && echo "Using: $1" 1>&2
                     . "$1"
                 else
                     _foamEtc -silent "$1"
diff --git a/etc/config.sh/gperftools b/etc/config.sh/gperftools
index f23ee42bbb059668b72b050d9b712fb789a8006a..e1d2a01a1cdf28c82abbb0a6b1b8b4743f2fdf73 100644
--- a/etc/config.sh/gperftools
+++ b/etc/config.sh/gperftools
@@ -40,7 +40,7 @@ GPERFTOOLS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$gperfto
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using gperftools ($gperftools_version)  ->  $GPERFTOOLS_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/hypre b/etc/config.sh/hypre
index 79fc3a316ef2b1e8ed49adbdbbdc9814e6cec7e1..7850728e414058b79c82a90f92a24208d4959cf2 100644
--- a/etc/config.sh/hypre
+++ b/etc/config.sh/hypre
@@ -31,7 +31,7 @@ export HYPRE_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRE
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using hypre ($hypre_version)  ->  $HYPRE_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 4feee873129a7f378082d407cd36a20bd4779d78..bba158bc4e839a1021f17da95946e591a49515dc 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -68,7 +68,7 @@ OPENMPI)
     # Inform openmpi where to find its install directory
     export OPAL_PREFIX=$MPI_ARCH_PATH
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         echo "Using $WM_MPLIB" 1>&2
         echo "    FOAM_MPI    : $FOAM_MPI" 1>&2
@@ -168,7 +168,7 @@ CRAY-MPICH)
     export FOAM_MPI=cray-mpich
     export MPI_ARCH_PATH=$MPICH_DIR
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         echo "Using $WM_MPLIB" 1>&2
         echo "    FOAM_MPI  : $FOAM_MPI" 1>&2
@@ -247,7 +247,7 @@ SGIMPI)
         echo "    Currently using '$MPI_ARCH_PATH'" 1>&2
     }
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         echo "Using $WM_MPLIB" 1>&2
         echo "    FOAM_MPI : $FOAM_MPI" 1>&2
@@ -269,7 +269,7 @@ INTELMPI)
         # If subdirectory is version number only, prefix with 'impi-'
         case "$FOAM_MPI" in ([0-9]*) FOAM_MPI="impi-$FOAM_MPI";; esac
 
-        if [ "$FOAM_VERBOSE" -a "$PS1" ]
+        if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
         then
             echo "Using $WM_MPLIB" 1>&2
             echo "    FOAM_MPI   : $FOAM_MPI" 1>&2
@@ -283,7 +283,7 @@ INTELMPI)
         # If subdirectory is version number only, prefix with 'impi-'
         case "$FOAM_MPI" in ([0-9]*) FOAM_MPI="impi-$FOAM_MPI";; esac
 
-        if [ "$FOAM_VERBOSE" -a "$PS1" ]
+        if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
         then
             echo "Using $WM_MPLIB" 1>&2
             echo "    FOAM_MPI : $FOAM_MPI" 1>&2
diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview
index 41c8c8e20c91345898a6eb564e8f398c422de6ce..591febeb8b66db8356500ce0ef32591c33d30ed1 100644
--- a/etc/config.sh/paraview
+++ b/etc/config.sh/paraview
@@ -58,18 +58,20 @@ pv_api=auto             # Either auto or pair of (major.minor) digits
 archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
 
 # Clean PATH and LD_LIBRARY_PATH
-eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
-    "$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-")
+eval \
+    "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
+    $ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-)"
 
-eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
-    "$ParaView_DIR $archDir/ParaView- $archDir/qt-")
+eval \
+    "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
+    $ParaView_DIR $archDir/ParaView- $archDir/qt-)"
 
 # ThirdParty cmake
-cmake=$archDir/$cmake_version
-if [ -r $cmake/bin/cmake ]
+cmake="$archDir/$cmake_version"
+if [ -r "$cmake/bin/cmake" ]
 then
     # _foamAddPath not available when foamPV function is used
-    PATH=$cmake/bin:$PATH
+    PATH="$cmake/bin:$PATH"
 fi
 
 # Evaluate command-line parameters for ParaView
@@ -159,7 +161,7 @@ then
             ;;
         esac
 
-        if [ "$FOAM_VERBOSE" -a "$PS1" ]
+        if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
         then
             echo "Using paraview"
             echo "    ParaView_DIR         : $ParaView_DIR"
diff --git a/etc/config.sh/petsc b/etc/config.sh/petsc
index 25448b7977472653120ae6f610e9db0e8dd31a8e..937d4ff50824dac6bd3b56accf86c26758cce4ad 100644
--- a/etc/config.sh/petsc
+++ b/etc/config.sh/petsc
@@ -31,7 +31,7 @@ export PETSC_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRE
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using petsc ($petsc_version)  ->  $PETSC_ARCH_PATH" 1>&2
 fi
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 6b51ae3b051435a0efae3d0f0fb2b8d9515683f8..c03bcdb2308fc0280d2408939bd25fbe1d4e141a 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -273,7 +273,7 @@ GCC_NOT_FOUND
 
     _foamAddLibAuto $mpcDir
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         echo "Using ThirdParty compiler"
         echo "    ${gccDir##*/}  (${gmpDir##*/}  $${mpfrDir##*/}  ${mpcDir##*/})"
@@ -299,7 +299,7 @@ CLANG_NOT_FOUND
     _foamAddPath    $clangDir/bin
     _foamAddLib     $clangDir/lib  # For things like libomp (openmp) etc
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
     then
         echo "Using ThirdParty compiler"
         echo "    ${clangDir##*/}"
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index 871afe1ecd5a0a442640ebe1244fe298d47afe91..4ebfe761851d3067c02503ca0391aa5310d8bb59 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -92,7 +92,7 @@ unset MPI_ARCH_PATH
 unset MPI_BUFFER_SIZE
 
 # Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
-if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
+if [ -n "$foamClean" ] && [ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ]
 then
     unset OPAL_PREFIX
 fi
@@ -108,7 +108,7 @@ unset PV_PLUGIN_PATH
 unset VTK_DIR
 
 # Undefine Qt5_DIR if set to one of the paths on foamOldDirs
-if [ -z "$($foamClean -env=Qt5_DIR "$foamOldDirs")" ]
+if [ -n "$foamClean" ] && [ -z "$($foamClean -env=Qt5_DIR $foamOldDirs)" ]
 then
     unset Qt5_DIR
 fi
@@ -137,9 +137,9 @@ unset SCOTCH_ARCH_PATH
 
 if [ -n "$foamClean" ]
 then
-    eval $($foamClean -sh-env=PATH "$foamOldDirs")
-    eval $($foamClean -sh-env=LD_LIBRARY_PATH "$foamOldDirs")
-    eval $($foamClean -sh-env=MANPATH "$foamOldDirs")
+    eval "$($foamClean -sh-env=PATH $foamOldDirs)"
+    eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
+    eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
 fi
 
 [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
@@ -189,7 +189,7 @@ unset -f foamPV     2>/dev/null
 foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
 for cleaned in $foamOldDirs
 do
-    complete -r $cleaned 2>/dev/null
+    complete -r "$cleaned" 2>/dev/null
 done
 
 # Completion functions
diff --git a/etc/config.sh/vtk b/etc/config.sh/vtk
index 6e4df894fa7ce12beffb875ee246bd7be3df5587..242407e977973e55c8eaac53cd029f4a81ed75c9 100644
--- a/etc/config.sh/vtk
+++ b/etc/config.sh/vtk
@@ -39,7 +39,7 @@ export MESA_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa_v
 
 # END OF (NORMAL) USER EDITABLE PART
 #------------------------------------------------------------------------------
-if [ "$FOAM_VERBOSE" -a "$PS1" ]
+if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
 then
     echo "Using vtk  ($vtk_version)  ->  $VTK_DIR" 1>&2
     echo "Using mesa ($mesa_version)  ->  $MESA_ARCH_PATH" 1>&2