From ea6b3da2accdda04fee8013979a539a5f9c7dd2e Mon Sep 17 00:00:00 2001 From: DavidSCN Date: Wed, 2 Jun 2021 08:52:20 +0200 Subject: [PATCH] Throw error in fenics and nutils run script if no argument was provided --- partitioned-heat-conduction/fenics/run.sh | 12 ++++++++++-- partitioned-heat-conduction/nutils/run.sh | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/partitioned-heat-conduction/fenics/run.sh b/partitioned-heat-conduction/fenics/run.sh index e31f07a10..e51fb750b 100755 --- a/partitioned-heat-conduction/fenics/run.sh +++ b/partitioned-heat-conduction/fenics/run.sh @@ -1,6 +1,14 @@ #!/bin/sh set -e -u +usage() { echo "Usage: cmd [-d] [-n]" 1>&2; exit 1; } + +# Check if no input argument was provided +if [ -z "$*" ] ; then + usage +fi + +# Select appropriate case while getopts ":dn" opt; do case ${opt} in d) @@ -9,8 +17,8 @@ while getopts ":dn" opt; do n) python3 heat.py -n --error-tol 10e-3 ;; - \?) - echo "Usage: cmd [-d] [-n]" + *) + usage ;; esac done diff --git a/partitioned-heat-conduction/nutils/run.sh b/partitioned-heat-conduction/nutils/run.sh index 43e97b70f..b3048a04f 100755 --- a/partitioned-heat-conduction/nutils/run.sh +++ b/partitioned-heat-conduction/nutils/run.sh @@ -1,6 +1,13 @@ #!/bin/sh set -e -u +usage() { echo "Usage: cmd [-d] [-n]" 1>&2; exit 1; } + +# Check if no input argument was provided +if [ -z "$*" ] ; then + usage +fi + while getopts ":dn" opt; do case ${opt} in d) @@ -11,8 +18,8 @@ while getopts ":dn" opt; do rm -rf Neumann-*.vtk python3 heat.py --side=Neumann ;; - \?) - echo "Usage: cmd [-d] [-n]" + *) + usage ;; esac done