ENH: abort if rsync is missing - foamCopySettings, foamNewCase
This commit is contained in:
parent
1aa25ebf39
commit
0f58ac5a9b
@ -37,9 +37,12 @@
|
||||
# to add any custom rsync options.
|
||||
#-------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ]
|
||||
then
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1" 1>&2; shift; done
|
||||
cat <<USAGE 1>&2
|
||||
|
||||
Usage: $Script srcDir dstDir
|
||||
|
||||
Copy OpenFOAM settings from one case to another, without copying
|
||||
@ -52,7 +55,29 @@ Note
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
-*)
|
||||
usage "unknown option: '$*'"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# need rsync
|
||||
type rsync >/dev/null 2>&1 || usage "Error: 'rsync' seems to be missing"
|
||||
|
||||
[ "$#" -eq 2 ] || usage "Error: incorrect number of arguments"
|
||||
|
||||
srcDir=${1%/}
|
||||
dstDir=${2%/}
|
||||
|
@ -55,7 +55,6 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset appName caseName listOpt
|
||||
|
||||
# parse options
|
||||
@ -84,12 +83,19 @@ do
|
||||
version="$2"
|
||||
shift 2
|
||||
;;
|
||||
-*)
|
||||
usage "unknown option: '$*'"
|
||||
;;
|
||||
*)
|
||||
usage "unknown option/argument: '$*'"
|
||||
usage "unexpected argument: '$*'"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# need rsync, except for when listing
|
||||
type rsync >/dev/null 2>&1 || [ "$listOpt" = true ] || usage "Error: 'rsync' seems to be missing"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
[ -n "$version" ] || {
|
||||
|
Loading…
Reference in New Issue
Block a user