From d3911dd16726ca05c24fca8979b85682495ac37e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Mon, 20 Feb 2017 09:30:58 +0100
Subject: [PATCH] STYLE: avoid old-style shell backticks in various places

---
 bin/foamEtcFile                               |  2 +-
 bin/foamPack                                  |  2 +-
 bin/foamRunTutorials                          |  4 +-
 etc/bashrc                                    | 36 ++++----
 etc/config.csh/ensight                        |  4 +-
 etc/config.csh/settings                       | 20 +++--
 etc/config.sh/ensight                         | 12 +--
 etc/config.sh/functions                       |  2 +-
 etc/config.sh/mpi                             |  8 +-
 etc/config.sh/settings                        | 37 ++++-----
 etc/config.sh/unset                           |  9 +-
 etc/cshrc                                     |  4 +-
 etc/templates/axisymmetricJet/Allrun          |  4 +-
 .../biconic25-55Run35/sampleCone              |  6 +-
 .../buoyantCavity/validation/createGraphs     |  2 +-
 .../externalSolver                            |  2 +-
 .../boundaryWallFunctionsProfile/Allrun       |  4 +-
 .../hotBoxes/patchifyObstacles                | 82 +++++++++----------
 .../interFoam/RAS/waterChannel/Allmesh        |  7 +-
 19 files changed, 117 insertions(+), 130 deletions(-)

diff --git a/bin/foamEtcFile b/bin/foamEtcFile
index 3d3d01864e4..5e21978b0e8 100755
--- a/bin/foamEtcFile
+++ b/bin/foamEtcFile
@@ -34,7 +34,7 @@
 #
 #     For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
 #     \code
-#        foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \
+#        foamPrefs=$($WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh) \
 #            && _foamSource $foamPrefs
 #     \endcode
 #
diff --git a/bin/foamPack b/bin/foamPack
index e3d090e2f29..212d0d5e5a3 100755
--- a/bin/foamPack
+++ b/bin/foamPack
@@ -119,7 +119,7 @@ else
     ( cd $packDir && git archive --format=tar --prefix=$packDir/ HEAD) > $packBase.tar &&
 
     echo "add in time-stamp and lnInclude directories" 1>&2 &&
-    tar cf $packBase.tar2 $packDir/.timeStamp $packDir/.build `find -H $packDir -type d -name lnInclude` &&
+    tar cf $packBase.tar2 $packDir/.timeStamp $packDir/.build $(find -H $packDir -type d -name lnInclude) &&
     tar Af $packBase.tar $packBase.tar2 &&
 
     echo "gzip tar file" 1>&2 &&
diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials
index 7aabb6c4800..dac6fc894fc 100755
--- a/bin/foamRunTutorials
+++ b/bin/foamRunTutorials
@@ -71,8 +71,8 @@ then
 elif [ -d system ]
 then
     # Run normal case.
-    parentDir=`dirname $PWD`
-    application=`getApplication`
+    parentDir=$(dirname $PWD)
+    application=$(getApplication)
     runApplication blockMesh
     runApplication $application
 else
diff --git a/etc/bashrc b/etc/bashrc
index 3f5d04e83bf..7eeb3c209aa 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  |
+#    \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -136,7 +136,7 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
 . $WM_PROJECT_DIR/etc/config.sh/functions
 
 # Add in preset user or site preferences:
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile prefs.sh)
 
 # Evaluate command-line parameters and record settings for later
 # these can be used to set/unset values, or specify alternative pref files
@@ -148,14 +148,14 @@ _foamEval $@
 foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
 
 #- Clean PATH
-cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
+cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
 
 #- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` \
+cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
     && LD_LIBRARY_PATH="$cleaned"
 
 #- Clean MANPATH
-cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
+cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
 
 export PATH LD_LIBRARY_PATH MANPATH
 
@@ -168,35 +168,35 @@ _foamSource $WM_PROJECT_DIR/etc/config.sh/aliases
 
 # Source user setup files for optional packages
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/vtk`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/vtk)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools)
 
-##_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/FFTW`
+##_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/FFTW)
 
 
 # Clean environment paths again. Only remove duplicates
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #- Clean PATH
-cleaned=`$foamClean "$PATH"` && PATH="$cleaned"
+cleaned=$($foamClean "$PATH") && PATH="$cleaned"
 
 #- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
+cleaned=$($foamClean "$LD_LIBRARY_PATH") && LD_LIBRARY_PATH="$cleaned"
 
 #- Clean MANPATH (trailing ':' to find system pages)
-cleaned=`$foamClean "$MANPATH"`: && MANPATH="$cleaned"
+cleaned=$($foamClean "$MANPATH") && MANPATH="${cleaned}:"
 
 export PATH LD_LIBRARY_PATH MANPATH
 
 #- Clean LD_PRELOAD
 if [ -n "$LD_PRELOAD" ]
 then
-    cleaned=`$foamClean "$LD_PRELOAD"` && LD_PRELOAD="$cleaned"
+    cleaned=$($foamClean "$LD_PRELOAD") && LD_PRELOAD="$cleaned"
     export LD_PRELOAD
 fi
 
diff --git a/etc/config.csh/ensight b/etc/config.csh/ensight
index 44f8a42ddf0..1eb65ffc1d6 100644
--- a/etc/config.csh/ensight
+++ b/etc/config.csh/ensight
@@ -38,9 +38,7 @@ endif
 if ( -r $CEI_HOME ) then
 
     # Special treatment for 32bit OpenFOAM and 64bit Ensight
-    if ($WM_ARCH == linux && `uname -m` == x86_64) then
-        setenv CEI_ARCH linux_2.6_32
-    endif
+    if ($WM_ARCH-`uname -m` == linux-x86_64) setenv CEI_ARCH linux_2.6_32
 
     # Add to path
     setenv PATH ${CEI_HOME}/bin:${PATH}
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 659b4c5ae22..74da787d227 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -75,7 +75,7 @@ case Linux:
             breaksw
 
         default:
-            echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
+            echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32|64"
             breaksw
 
         endsw
@@ -124,11 +124,13 @@ case SunOS:
     setenv WM_LDFLAGS '-mabi=64 -G0'
     breaksw
 
-default:
-    echo
-    echo "Your '$WM_ARCH' operating system is not supported by this release"
-    echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.com"
-    echo
+default:  # An unsupported operating system
+    /bin/cat <<USAGE
+
+Your "$WM_ARCH" operating system is unsupported by this OpenFOAM release.
+For further assistance, please contact www.OpenFOAM.com
+
+USAGE
     breaksw
 
 endsw
@@ -230,7 +232,7 @@ case ThirdParty:
 
         # Check that the compiler directory can be found
         if ( ! -d "$gccDir" ) then
-            cat << GCC_NOT_FOUND
+            /bin/cat << GCC_NOT_FOUND
 ===============================================================================
 Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
 Cannot find '$WM_COMPILER' compiler installation
@@ -272,7 +274,7 @@ GCC_NOT_FOUND
 
         # Check that the compiler directory can be found
         if ( ! -d "$clangDir" ) then
-            cat << CLANG_NOT_FOUND
+            /bin/cat << CLANG_NOT_FOUND
 ===============================================================================
 Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
 Cannot find '$WM_COMPILER' compiler installation
diff --git a/etc/config.sh/ensight b/etc/config.sh/ensight
index 616adfdc799..ec7566a80a1 100644
--- a/etc/config.sh/ensight
+++ b/etc/config.sh/ensight
@@ -31,22 +31,16 @@
 #------------------------------------------------------------------------------
 
 # Fallback value
-if [ ! -d "$CEI_HOME" ]
-then
-    export CEI_HOME=/usr/local/ensight/CEI
-fi
+[ -d "$CEI_HOME" ] || export CEI_HOME=/usr/local/ensight/CEI
 
 if [ -r $CEI_HOME ]
 then
 
     # Special treatment for 32bit OpenFOAM and 64bit Ensight
-    if [ "$WM_ARCH" = linux -a `uname -m` = x86_64 ]
-    then
-        export CEI_ARCH=linux_2.6_32
-    fi
+    [ "$WM_ARCH-$(uname -m)" = linux-x86_64 ] && export CEI_ARCH=linux_2.6_32
 
     # Add to path if required
-    if [ "$CEI_HOME/bin/ensight" != "`which ensight 2>/dev/null`" ]
+    if [ "$CEI_HOME/bin/ensight" != "$(command -v ensight)" ]
     then
         export PATH=$CEI_HOME/bin:$PATH
     fi
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index b31e670ca71..20b30f697d3 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -73,7 +73,7 @@ then
                 then
                     _foamSource "$1"
                 else
-                    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"`
+                    _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile -silent "$1")
                 fi
                 ;;
             esac
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 757aef05ee2..8f01dc20fac 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -43,7 +43,7 @@ SYSTEMOPENMPI)
         unset OPAL_PREFIX
     fi
 
-    libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
+    libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')
 
     # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
     # include files and libraries.
@@ -56,7 +56,7 @@ SYSTEMOPENMPI)
 OPENMPI)
     export FOAM_MPI=openmpi-1.10.4
     # Optional configuration tweaks:
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/openmpi`
+    _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/openmpi)
 
     export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
 
@@ -159,7 +159,7 @@ HPMPI)
 
     _foamAddPath $MPI_ARCH_PATH/bin
 
-    case `uname -m` in
+    case $(uname -m) in
     i686)
         _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
         ;;
@@ -171,7 +171,7 @@ HPMPI)
         _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
         ;;
     *)
-        echo Unknown processor type `uname -m` 1>&2
+        echo Unknown processor type $(uname -m) 1>&2
         ;;
     esac
     ;;
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 4e457c15c00..f395db6207b 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -31,21 +31,21 @@
 #------------------------------------------------------------------------------
 
 # Set environment variables according to system type
-export WM_ARCH=`uname -s`
+export WM_ARCH=$(uname -s)
 
 case "$WM_ARCH" in
 Linux)
     WM_ARCH=linux
 
     # Compiler specifics
-    case `uname -m` in
-        i686)
-            export WM_ARCH_OPTION=32
-            export WM_CC='gcc'
-            export WM_CXX='g++'
-            export WM_CFLAGS='-fPIC'
-            export WM_CXXFLAGS='-fPIC -std=c++0x'
-            export WM_LDFLAGS=
+    case $(uname -m) in
+    i686)
+        export WM_ARCH_OPTION=32
+        export WM_CC='gcc'
+        export WM_CXX='g++'
+        export WM_CFLAGS='-fPIC'
+        export WM_CXXFLAGS='-fPIC -std=c++0x'
+        export WM_LDFLAGS=
         ;;
 
     x86_64)
@@ -68,8 +68,7 @@ Linux)
             export WM_LDFLAGS='-m64'
             ;;
         *)
-            echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\
-                 1>&2
+            echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32|64" 1>&2
             ;;
         esac
         ;;
@@ -111,7 +110,7 @@ Linux)
         ;;
 
     *)
-        echo Unknown processor type `uname -m` for Linux 1>&2
+        echo Unknown processor type $(uname -m) for Linux 1>&2
         ;;
     esac
     ;;
@@ -127,11 +126,11 @@ SunOS)
     export WM_LDFLAGS='-mabi=64 -G0'
     ;;
 
-*)    # An unsupported operating system
+*)  # An unsupported operating system
     /bin/cat <<USAGE 1>&2
 
-    Your "$WM_ARCH" operating system is not supported by this release
-    of OpenFOAM. For further assistance, please contact www.OpenFOAM.com
+Your "$WM_ARCH" operating system is unsupported by this OpenFOAM release.
+For further assistance, please contact www.OpenFOAM.com
 
 USAGE
     ;;
@@ -212,7 +211,7 @@ unset GMP_ARCH_PATH MPFR_ARCH_PATH
 
 # Load configured compiler versions, regardless of the compiler type
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler`
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler)
 
 case "$WM_COMPILER_TYPE" in
 system)
@@ -227,7 +226,7 @@ OpenFOAM | ThirdParty)
         mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${mpc_version:-mpc-system}
 
         # Check that the compiler directory can be found
-        [ -d "$gccDir" ] || cat << GCC_NOT_FOUND 1>&2
+        [ -d "$gccDir" ] || /bin/cat << GCC_NOT_FOUND 1>&2
 ===============================================================================
 Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
 Cannot find '$WM_COMPILER' compiler installation
@@ -272,7 +271,7 @@ GCC_NOT_FOUND
         clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
 
         # Check that the compiler directory can be found
-        [ -d "$clangDir" ] || cat << CLANG_NOT_FOUND 1>&2
+        [ -d "$clangDir" ] || /bin/cat << CLANG_NOT_FOUND 1>&2
 ===============================================================================
 Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
 Cannot find '$WM_COMPILER' compiler installation
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index a636b94a816..2fa155d8c79 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -143,9 +143,9 @@ unset SCOTCH_ARCH_PATH
 
 if [ -n "$foamClean" ]
 then
-    cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
-    cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleaned"
-    cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
+    cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
+    cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") && LD_LIBRARY_PATH="$cleaned"
+    cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
 fi
 
 
@@ -153,7 +153,6 @@ fi
 [ -n "$MANPATH" ] || unset MANPATH
 [ -n "$LD_PRELOAD" ] || unset LD_PRELOAD
 
-
 unset cleaned foamClean foamOldDirs
 
 
diff --git a/etc/cshrc b/etc/cshrc
index d5f315ee162..0352fe8a6da 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -234,8 +234,8 @@ set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
 if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
 
 #- Clean MANPATH (trailing ':' to find system pages)
-set cleaned=`$foamClean "$MANPATH"`:
-if ( $status == 0 ) setenv MANPATH "$cleaned"
+set cleaned=`$foamClean "$MANPATH"`
+if ( $status == 0 ) setenv MANPATH "${cleaned}:"
 
 #- Clean LD_PRELOAD
 if ( $?LD_PRELOAD ) then
diff --git a/etc/templates/axisymmetricJet/Allrun b/etc/templates/axisymmetricJet/Allrun
index 411484a5bf9..c5a0b2cea66 100755
--- a/etc/templates/axisymmetricJet/Allrun
+++ b/etc/templates/axisymmetricJet/Allrun
@@ -4,11 +4,9 @@ cd ${0%/*} || exit 1    # run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
-
 runApplication blockMesh
 runApplication extrudeMesh
 
-runApplication $application
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone
index e201d5bdc02..a07cffaf68b 100755
--- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone
+++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone
@@ -44,9 +44,9 @@ done
 
 sample $timeOpt
 SDIR=sets
-LSDIR=`ls $SDIR | head -1`
-EXAMPLE_FILE=`ls -1 $SDIR/${LSDIR}/* | head -1`
-FS=`basename $EXAMPLE_FILE | cut -d_ -f2-`
+LSDIR=$(ls $SDIR | head -1)
+EXAMPLE_FILE=$(ls -1 $SDIR/${LSDIR}/* | head -1)
+FS=$(basename $EXAMPLE_FILE | cut -d_ -f2-)
 
 for d in $SDIR/*
 do
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
index 5566e9f677d..6874fa26efa 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
@@ -95,7 +95,7 @@ then
 fi
 
 # paths to data
-LATESTTIME=`ls $SETSDIR`
+LATESTTIME=$(ls $SETSDIR)
 OFDATAROOT=$SETSDIR/$LATESTTIME
 
 EXPTDATAROOT=./exptData
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver
index 201bc166822..040a5a5d66b 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver
@@ -82,7 +82,7 @@ do
              break
         elif [ -s $lockFile ]
         then
-             log "found lock file ${lockFile} containing '$(cat $lockFile)' - waiting"
+             log "found lock file ${lockFile} containing '$(< $lockFile)' - waiting"
         else
              log "found lock file ${lockFile} - waiting"
         fi
diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
index 02e0ed60853..ae838574d94 100755
--- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
+++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
@@ -25,8 +25,8 @@ do
 
     if [ -e logs/yPlus_0 ]
     then
-        yPlus=`awk < logs/yPlus_0 'END{print $2}'`
-        uPlus=`awk < logs/uPlus_0 'END{print $2}'`
+        yPlus=$(awk < logs/yPlus_0 'END{print $2}')
+        uPlus=$(awk < logs/uPlus_0 'END{print $2}')
 
         echo "$yPlus $uPlus" >> yPlus_vs_uPlus
     fi
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/patchifyObstacles b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/patchifyObstacles
index 0a651b82d41..be3c7aded10 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/patchifyObstacles
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/patchifyObstacles
@@ -1,5 +1,5 @@
 #!/bin/sh
-#--------------------------------*- C++ -*------------------------------------#
+#-----------------------------------------------------------------------------#
 # =========                 |                                                 #
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           #
 #  \\    /   O peration     | Version:  plus                                  #
@@ -77,80 +77,80 @@ for xi in $(seq 1 1 $nx); do
 
            # side 1
            side=1
-           x1=`echo $x $tol | awk '{print $1 - $2}'`
-           x2=`echo $x $l $tol | awk '{print $1 + $2 + $3}'`
-           y1=`echo $y $tol | awk '{print $1 - $2}'`
-           y2=`echo $y $l $tol | awk '{print $1 + $2 + $3}'`
-           z1=`echo $z $l $tol | awk '{print $1 + $2 - $3}'`
-           z2=`echo $z $l $tol | awk '{print $1 + $2 + $3}'`
+           x1=$(echo $x $tol | awk '{print $1 - $2}')
+           x2=$(echo $x $l $tol | awk '{print $1 + $2 + $3}')
+           y1=$(echo $y $tol | awk '{print $1 - $2}')
+           y2=$(echo $y $l $tol | awk '{print $1 + $2 + $3}')
+           z1=$(echo $z $l $tol | awk '{print $1 + $2 - $3}')
+           z2=$(echo $z $l $tol | awk '{print $1 + $2 + $3}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            #  side 2
            side=2
-           x1=`echo $x $l $tol | awk '{print $1 + $2 - $3}'`
-           x2=`echo $x $l $tol | awk '{print $1 + $2 + $3}'`
-           y1=`echo $y $tol | awk '{print $1 - $2}'`
-           y2=`echo $y $l $tol | awk '{print $1 + $2 + $3}'`
-           z1=`echo $z $tol  | awk '{print $1 - $2}'`
-           z2=`echo $z $l $tol | awk '{print $1 + $2 + $3}'`
+           x1=$(echo $x $l $tol | awk '{print $1 + $2 - $3}')
+           x2=$(echo $x $l $tol | awk '{print $1 + $2 + $3}')
+           y1=$(echo $y $tol | awk '{print $1 - $2}')
+           y2=$(echo $y $l $tol | awk '{print $1 + $2 + $3}')
+           z1=$(echo $z $tol  | awk '{print $1 - $2}')
+           z2=$(echo $z $l $tol | awk '{print $1 + $2 + $3}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            # side 3
            side=3
-           x1=`echo $x $tol | awk '{print $1 - $2}'`
-           x2=`echo $x $l $tol | awk '{print $1 + $2 + $3}'`
-           y1=`echo $y $tol | awk '{print $1 - $2}'`
-           y2=`echo $y $l $tol | awk '{print $1 + $2 + $3}'`
-           z1=`echo $z $tol | awk '{print $1 - $2}'`
-           z2=`echo $z $tol | awk '{print $1 + $2}'`
+           x1=$(echo $x $tol | awk '{print $1 - $2}')
+           x2=$(echo $x $l $tol | awk '{print $1 + $2 + $3}')
+           y1=$(echo $y $tol | awk '{print $1 - $2}')
+           y2=$(echo $y $l $tol | awk '{print $1 + $2 + $3}')
+           z1=$(echo $z $tol | awk '{print $1 - $2}')
+           z2=$(echo $z $tol | awk '{print $1 + $2}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            # side 4
            side=4
-           x1=`echo $x $tol | awk '{print $1 - $2}'`
-           x2=`echo $x $tol | awk '{print $1 + $2}'`
-           y1=`echo $y $tol | awk '{print $1 - $2}'`
-           y2=`echo $y $l $tol | awk '{print $1 + $2 + $3}'`
-           z1=`echo $z $tol | awk '{print $1 - $2}'`
-           z2=`echo $z $l $tol | awk '{print $1 + $2 + $3}'`
+           x1=$(echo $x $tol | awk '{print $1 - $2}')
+           x2=$(echo $x $tol | awk '{print $1 + $2}')
+           y1=$(echo $y $tol | awk '{print $1 - $2}')
+           y2=$(echo $y $l $tol | awk '{print $1 + $2 + $3}')
+           z1=$(echo $z $tol | awk '{print $1 - $2}')
+           z2=$(echo $z $l $tol | awk '{print $1 + $2 + $3}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            # side 5
            side=5
-           x1=`echo $x $tol | awk '{print $1 - $2}'`
-           x2=`echo $x $l $tol | awk '{print $1 + $2 + $3}'`
-           y1=`echo $y $l $tol | awk '{print $1 + $2 - $3}'`
-           y2=`echo $y $l $tol | awk '{print $1 + $2 + $3}'`
-           z1=`echo $z $tol | awk '{print $1 - $2}'`
-           z2=`echo $z $l $tol | awk '{print $1 + $2 + $3}'`
+           x1=$(echo $x $tol | awk '{print $1 - $2}')
+           x2=$(echo $x $l $tol | awk '{print $1 + $2 + $3}')
+           y1=$(echo $y $l $tol | awk '{print $1 + $2 - $3}')
+           y2=$(echo $y $l $tol | awk '{print $1 + $2 + $3}')
+           z1=$(echo $z $tol | awk '{print $1 - $2}')
+           z2=$(echo $z $l $tol | awk '{print $1 + $2 + $3}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            # side 6
            side=6
-           x1=`echo $x $tol | awk '{print $1 - $2}'`
-           x2=`echo $x $l $tol | awk '{print $1 + $2 + $3}'`
-           y1=`echo $y $tol | awk '{print $1 - $2}'`
-           y2=`echo $y $tol | awk '{print $1 + $2}'`
-           z1=`echo $z $tol | awk '{print $1 - $2}'`
-           z2=`echo $z $l $tol | awk '{print $1 + $2 + $3}'`
+           x1=$(echo $x $tol | awk '{print $1 - $2}')
+           x2=$(echo $x $l $tol | awk '{print $1 + $2 + $3}')
+           y1=$(echo $y $tol | awk '{print $1 - $2}')
+           y2=$(echo $y $tol | awk '{print $1 + $2}')
+           z1=$(echo $z $tol | awk '{print $1 - $2}')
+           z2=$(echo $z $l $tol | awk '{print $1 + $2 + $3}')
            addToFaceSet cube${pad}${n}_side${side} $x1 $x2 $y1 $y2 $z1 $z2
 
            n=$((n+1))
 
-           z=`echo $z $offset | awk '{print $1 + $2}'`
+           z=$(echo $z $offset | awk '{print $1 + $2}')
        done
 
-       y=`echo $y $offset | awk '{print $1 + $2}'`
+       y=$(echo $y $offset | awk '{print $1 + $2}')
    done
 
-   x=`echo $x $offset | awk '{print $1 + $2}'`
+   x=$(echo $x $offset | awk '{print $1 + $2}')
 done
 
 echo "cellSet cubeFacesCells new faceToCell cubeFaceSet owner" >> $tmpSetSet
 echo "faceZoneSet cubeFaces new setsToFaceZone cubeFaceSet cubeFacesCells" >> $tmpSetSet
 
 echo "processing floor"
-floorMax=`echo 1 $tol | awk '{print $1 + $2}'`
+floorMax=$(echo 1 $tol | awk '{print $1 + $2}')
 createSetsAndZone Floor -$tol $floorMax -$tol $floorMax -$tol $tol
 echo "cellSet floorCells new faceToCell FloorFaces owner" >> $tmpSetSet
 echo "faceZoneSet floorFaces new setsToFaceZone FloorFaces floorCells" >> $tmpSetSet
diff --git a/tutorials/multiphase/interFoam/RAS/waterChannel/Allmesh b/tutorials/multiphase/interFoam/RAS/waterChannel/Allmesh
index f476661eb3f..92d09ceaef7 100755
--- a/tutorials/multiphase/interFoam/RAS/waterChannel/Allmesh
+++ b/tutorials/multiphase/interFoam/RAS/waterChannel/Allmesh
@@ -4,17 +4,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=$(getApplication)
-
 runApplication blockMesh
 
 echo "Creating channel"
-i=1
-while [ "$i" -lt 3 ] ; do
+for i in 1 2
+do
     cp system/extrudeMeshDict.${i} system/extrudeMeshDict
     echo "Running extrudeMesh, instance" ${i}
     extrudeMesh > log.extrudeMesh.${i}
-    i=`expr $i + 1`
 done
 
 #------------------------------------------------------------------------------
-- 
GitLab