Scripts in bin: added -help to scripts

This commit is contained in:
Chris Greenshields
2017-05-29 21:02:16 +01:00
parent 72d2f4c700
commit d8291f848d
2 changed files with 54 additions and 25 deletions

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -30,15 +30,34 @@
# and all its subdirectories.
#
#------------------------------------------------------------------------------
Script=$PWD/${0##*/}
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
. "$WM_PROJECT_DIR/bin/tools/CleanFunctions"
thisScript=$0
if [ "/${thisScript#/}" != "$thisScript" ]
then
thisScript="$PWD/$thisScript"
fi
usage() {
cat<<USAGE
Usage: ${0##*/} [OPTIONS]
options:
-help | -h help
Helper script used by the Allclean scripts in the OpenFOAM tutorials
USAGE
}
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage && exit 0
;;
*)
break
;;
esac
done
# If an argument is supplied do not execute ./Allwclean or ./Allclean
# (to avoid recursion)
@ -62,7 +81,7 @@ else
# Recurse into subdirectories
for caseName in *
do
( cd $caseName 2>/dev/null && $thisScript )
( cd "$caseName" 2>/dev/null && $Script )
done
fi