diff --git a/bin/foamTestTutorial b/bin/foamTestTutorial
index a2e94a217a579218e320b12deb7c241d029f0030..a10d6bd05dfd4661bd6276206e5db4610b29a8aa 100755
--- a/bin/foamTestTutorial
+++ b/bin/foamTestTutorial
@@ -151,10 +151,10 @@ modifyCaseControlDict()
     do
         cp -f "${dict}" "${dict}.orig"
         sed \
-            -e 's/\(startFrom[ \t]*\)\([A-Za-z]*\);/\1 latestTime;/' \
-            -e 's/\(stopAt[ \t]*\)\([A-Za-z]*\);/\1 nextWrite;/' \
-            -e 's/\(writeControl[ \t]*\)\([A-Za-z]*\);/\1 timeStep;/' \
-            -e 's/\(writeInterval[ \t]*\)\([-.0-9A-Za-z]*\);/\1 '"$optRunLimit"';/' \
+            -e 's/\(startFrom[ \t]*\)[^ \t;]*;/\1 latestTime;/' \
+            -e 's/\(stopAt[ \t]*\)[^ \t;]*;/\1 nextWrite;/' \
+            -e 's/\(writeControl[ \t]*\)[^ \t;]*;/\1 timeStep;/' \
+            -e 's/\(writeInterval[ \t]*\)[^ \t;]*;/\1 '"${optRunLimit:-1}"';/' \
             "${dict}.orig" > "${dict}"
     done
 }
diff --git a/bin/tools/openfoam.in b/bin/tools/openfoam.in
index d712512d0c748854ffa0484f79c97cd1ed330a83..5676d240d71f6917f5f2ef8db46fb3ce2628ae49 100644
--- a/bin/tools/openfoam.in
+++ b/bin/tools/openfoam.in
@@ -1,19 +1,13 @@
 #!/bin/sh
 exec "@PROJECT_DIR@"/etc/openfoam "$@"
 #------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | www.openfoam.com
-#    \\/     M anipulation  |
-#------------------------------------------------------------------------------
-#     Copyright (C) 2020 OpenCFD Ltd.
-#------------------------------------------------------------------------------
-# License
-#     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
+# OpenFOAM file (www.openfoam.com)
+#
+# Copyright (C) 2020-2021 OpenCFD Ltd.
+# SPDX-License-Identifier: (GPL-3.0+)
 #
 # Description
-#     Forwarding to OpenFOAM etc/openfoam bash session script.
-#     Uses a hard-code directory path (eg, generated with autoconfig).
+#     Forward to OpenFOAM etc/openfoam bash session script.
+#     Uses hard-coded directory path.
 #
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/setup b/etc/config.csh/setup
index 070233ddc809d8f6dda86a91121612095084c395..a852c9461d6f087b2ac9fdfe18e4242cbbd6c307 100644
--- a/etc/config.csh/setup
+++ b/etc/config.csh/setup
@@ -5,7 +5,7 @@
 #   \\  /    A nd           | www.openfoam.com
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
-#     Copyright (C) 2018-2020 OpenCFD Ltd.
+#     Copyright (C) 2018-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -105,7 +105,10 @@ while ( $#argv > 0 )
     switch ($argv[1])
     case -*:
         # Stray option (not meant for us here) -> get out
-        break
+        break  # Break while
+        breaksw
+    case =*:
+        # Junk
         breaksw
     case *=:
         # name=       -> unsetenv name
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index 9c55f5cdd8c4b0f61d953632ceff45ca232a45ec..5945ba8bde9f739375f85894d4e31798bfaf7fae 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -6,7 +6,7 @@
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 #     Copyright (C) 2011-2016 OpenFOAM Foundation
-#     Copyright (C) 2017-2020 OpenCFD Ltd.
+#     Copyright (C) 2017-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -159,45 +159,6 @@ then
     fi
 
 
-    # Evaluate command-line parameters
-    unset -f _foamEval 2>/dev/null
-    _foamEval()
-    {
-        for i
-        do
-            case "$i" in
-            -*)
-                # Stray option (not meant for us here) -> get out
-                break
-                ;;
-            *=)
-                # name=       -> unset name
-                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
-                    && echo "unset ${1%=}" 1>&2
-                eval "unset ${1%=}"
-                ;;
-            *=*)
-                # name=value  -> export name=value
-                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
-                    && echo "export $i" 1>&2
-                eval "export $i"
-                ;;
-            *)
-                # Filename: source it
-                if [ -f "$i" ]
-                then
-                    [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
-                        && echo "Using: $i" 1>&2
-                    . "$i"
-                else
-                    _foamEtc -silent "$i"
-                fi
-                ;;
-            esac
-        done
-    }
-
-
     #--------------------------------------------------------------------------
     # Avoid any ThirdParty settings that may have 'leaked' into the environment
 
@@ -221,7 +182,7 @@ else
     # Was previously loaded/defined - now unset
 
     unset -f _foamAddPath _foamAddMan _foamAddLib _foamAddLibAuto 2>/dev/null
-    unset -f _foamClean _foamEcho _foamEtc _foamEval 2>/dev/null
+    unset -f _foamClean _foamEcho _foamEtc 2>/dev/null
     unset foamClean
     unset WM_SHELL_FUNCTIONS
 
diff --git a/etc/config.sh/setup b/etc/config.sh/setup
index b5adaa08f8be466ce95a8205eb94559523c1e792..a5440df6f45458e730c20f32bc2ed7fb6c2651a5 100644
--- a/etc/config.sh/setup
+++ b/etc/config.sh/setup
@@ -5,7 +5,7 @@
 #   \\  /    A nd           | www.openfoam.com
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
-#     Copyright (C) 2018-2020 OpenCFD Ltd.
+#     Copyright (C) 2018-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -106,19 +106,64 @@ then
 fi
 
 
-# Capture and evaluate any command-line parameters
-# These can be used to set/unset values, specify additional files etc.
-FOAM_SETTINGS="$@"
+#----------------------------------------------------------------------------
 
-# Evaluate the command-line parameters, which were saved as FOAM_SETTINGS.
-# These can be used to set/unset values, specify additional files etc.
-if [ -z "$FOAM_SETTINGS" ]
+# Capture and evaluate command-line parameters
+# - set/unset values, specify additional files etc.
+# - parameters never start with '-'
+if [ "$#" -gt 0 ] && [ "${1#-}" = "${1}" ]
 then
-    unset FOAM_SETTINGS
+    FOAM_SETTINGS="$@"
+    if [ -n "$FOAM_SETTINGS" ]
+    then
+        export FOAM_SETTINGS
+
+        for foamVar_eval
+        do
+            case "$foamVar_eval" in
+            (-*)
+                # Stray option (not meant for us here) -> get out
+                break
+                ;;
+            (=*)
+                # Junk
+                ;;
+            (*=)
+                # name=       -> unset name
+                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                    && echo "unset ${foamVar_eval%=}" 1>&2
+                eval "unset ${foamVar_eval%=}"
+                ;;
+            (*=*)
+                # name=value  -> export name=value
+                [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                    && echo "export $foamVar_eval" 1>&2
+                eval "export $foamVar_eval"
+                ;;
+            (*)
+                # Filename: source it
+                if [ -f "$foamVar_eval" ]
+                then
+                    [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
+                        && echo "Using: $foamVar_eval" 1>&2
+                    . "$foamVar_eval"
+                elif [ -n "$foamVar_eval" ]
+                then
+                    _foamEtc -silent "$foamVar_eval"
+                fi
+                ;;
+            esac
+        done
+    else
+        unset FOAM_SETTINGS
+    fi
 else
-    export FOAM_SETTINGS
-    _foamEval "$@"
+    unset FOAM_SETTINGS
 fi
+unset foamVar_eval
+
+
+#----------------------------------------------------------------------------
 
 # Verify FOAM_CONFIG_ETC (from calling environment or from prefs)
 if [ -n "$FOAM_CONFIG_ETC" ]
diff --git a/etc/openfoam b/etc/openfoam
index 87191ad7168e3403f51910e0f50404fb2dbaf4ee..7a29ff2b4483ad26011ab3e5f14d732d4f41873e 100755
--- a/etc/openfoam
+++ b/etc/openfoam
@@ -31,7 +31,7 @@
 #       -int32  | -DWM_LABEL_SIZE=32
 #       -int64  | -DWM_LABEL_SIZE=64
 #
-#     However, the '-D' options grant more flexibility. For example,
+#     The '-D' options grant even more flexibility. For example,
 #         etc/openfoam -DWM_COMPILER=Clang
 #
 # SeeAlso
@@ -43,26 +43,30 @@ projectDir="$(\cd "$(dirname "${0%/*}")" && \pwd -L)"
 
 #------------------------------------------------------------------------------
 printHelp() {
-    cat<<USAGE
+    cat<<HELP_USAGE
 
-Usage: ${0##*/} [OPTION] [application ...]
+Usage: ${0##*/} [OPTION] [[--] application ...]
 
 options:
-  -c command            Execute shell commands with OpenFOAM environment
-  -Dkey[=value]         Define key/value to pass as a preference
-  -sp                   Single precision
-  -dp                   Double precision
-  -spdp                 Mixed single/double precision
-  -int32 | -int64       The label-size
-  -etc=DIR              Additional project etc/ directory
-  -prefix=DIR           Alternative OpenFOAM project directory
-  -show-api | -version  Print META-INFO api value and exit
-  -show-patch           Print META-INFO patch value and exit
-  -show-prefix          Print project directory and exit
-  -test-tutorial        Forward arguments to bin/foamTestTutorial
-  -init=FILE            Alternative initialization file (expert option)
-  -verbose              Set FOAM_VERBOSE=true (interactive only)
-  -help                 Print the usage
+  -c                Shell commands read from the first non-option argument
+  -Dkey[=value]     Define key/value to pass as a preference
+  -sp               Single precision
+  -dp               Double precision
+  -spdp             Mixed single/double precision
+  -int32            Label-size 32
+  -int64            Label-size 64
+  -etc=DIR          Additional project etc/ directory
+  -prefix=DIR       Alternative OpenFOAM project directory
+  -show-api         Print META-INFO api value and exit
+  -show-patch       Print META-INFO patch value and exit
+  -show-prefix      Print project directory and exit
+  -test-tutorial    Forward arguments to bin/foamTestTutorial
+  -init=FILE        Alternative initialization file (expert option)
+  -version          Same as -show-api
+  -verbose          Set FOAM_VERBOSE=true (interactive only)
+  --                The end of option processing.
+                    An argument of - or / is equivalent to --.
+  -help             Print the usage
 
 Open an interactive bash session with an OpenFOAM environment,
 or run an OpenFOAM application (with arguments) after first sourcing
@@ -76,7 +80,7 @@ For a persistent OpenFOAM environment, the following can be added to your
 
 For more information: www.openfoam.com
 
-USAGE
+HELP_USAGE
     exit 0 # A clean exit
 }
 
@@ -110,7 +114,12 @@ unset optTestTut
 while [ "$#" -gt 0 ]
 do
     case "$1" in
-    -h | -help* | --help*)
+    ('') ;;
+    (- | -- | /)
+        shift
+        break   # Stop option parsing
+        ;;
+    (-h | -help* | --help*)
         printHelp
         ;;
     -show-api | -version | --version)  # Show API and exit
@@ -130,14 +139,8 @@ do
         optTestTut=true
         ;;
 
-    -c)  # Shell command
-        _foamScriptCommand="$2"
-        [ -n "$_foamScriptCommand" ] || {
-            echo "$0: missing or bad command argument: $2" 1>&2
-            exit 1
-        }
-        shift 2
-        break
+    (-c)  # Shell command
+        _foamScriptCommand="-c"
         ;;
 
     -D*)  # Define key/value to pass as preference
@@ -175,11 +178,6 @@ do
     -verbose)
         export FOAM_VERBOSE=true
         ;;
-
-    --)
-        shift
-        break
-        ;;
     -*)
         echo "$0: unknown option: '$1'" 1>&2
         exit 1
@@ -217,7 +215,14 @@ fi
 
 unset interactive
 
-if [ "$#" -eq 0 ] && [ -z "$_foamScriptCommand" ] && [ -z "$optTestTut" ]
+if [ -n "$_foamScriptCommand" ]
+then
+    if [ "$#" -eq 0 ]
+    then
+        echo "$0: -c: option requires an argument" 1>&2
+        exit 1
+    fi
+elif [ "$#" -eq 0 ] && [ -z "$optTestTut" ]
 then
     interactive=true
 fi
@@ -283,16 +288,14 @@ sourceBashrc()
 if [ -n "$_foamScriptCommand" ]
 then
     # A shell command
-
     sourceBashrc
-    exec bash -c "$_foamScriptCommand" "$@"
+    exec bash -c "$@"
     exit $? # Safety
 fi
 
-
 if [ -n "$optTestTut" ]
 then
-
+    # Test tutorial(s)
     sourceBashrc
     exec "$WM_PROJECT_DIR"/bin/foamTestTutorial "$@"
     exit $? # Safety
diff --git a/tutorials/Alltest b/tutorials/Alltest
index 7339b01ae1d8cc2971dc4afa8fa231e503565623..847c2dc778813703c5b4201bb72a1186e6bf82fb 100755
--- a/tutorials/Alltest
+++ b/tutorials/Alltest
@@ -71,7 +71,7 @@ while [ "$#" -gt 0 ]
 do
     case "$1" in
     -h* | -help*)   printHelp ;;
-    -f | -force)   optForce=true ;;
+    -f | -force)    optForce=true ;;
 
     -root=*)
         rootDir="${1#*=}"
@@ -148,10 +148,10 @@ modifyCaseControlDict()
     do
         cp -f "${dict}" "${dict}.orig"
         sed \
-            -e 's/\(startFrom[ \t]*\)\([A-Za-z]*\);/\1 latestTime;/' \
-            -e 's/\(stopAt[ \t]*\)\([A-Za-z]*\);/\1 nextWrite;/' \
-            -e 's/\(writeControl[ \t]*\)\([A-Za-z]*\);/\1 timeStep;/' \
-            -e 's/\(writeInterval[ \t]*\)\([-.0-9A-Za-z]*\);/\1 '"$optRunLimit"';/' \
+            -e 's/\(startFrom[ \t]*\)[^ \t;]*;/\1 latestTime;/' \
+            -e 's/\(stopAt[ \t]*\)[^ \t;]*;/\1 nextWrite;/' \
+            -e 's/\(writeControl[ \t]*\)[^ \t;]*;/\1 timeStep;/' \
+            -e 's/\(writeInterval[ \t]*\)[^ \t;]*;/\1 '"${optRunLimit:-1}"';/' \
             "${dict}.orig" > "${dict}"
     done
 }