diff --git a/src/training/tesstrain.sh b/src/training/tesstrain.sh index f0f4ba2341..6aa04626ff 100755 --- a/src/training/tesstrain.sh +++ b/src/training/tesstrain.sh @@ -47,7 +47,7 @@ echo -e "USAGE: tesstrain.sh } source "$(dirname $0)/tesstrain_utils.sh" -if [[ "$1" == "--help" || "$1" == "-h" ]]; then +if [[ $# -eq 0 || "$1" == "--help" || "$1" == "-h" ]]; then display_usage exit 0 fi diff --git a/src/training/tesstrain_utils.sh b/src/training/tesstrain_utils.sh index 426453d4f5..220688dd36 100644 --- a/src/training/tesstrain_utils.sh +++ b/src/training/tesstrain_utils.sh @@ -16,6 +16,13 @@ # # USAGE: source tesstrain_utils.sh +if [ -n "$BASH_VERSION" ];then + set -u # comment in case of "unbound variable" error or fix the code + set -eo pipefail; +else + echo "Warning: you aren't running script in bash - expect problems..." + fi + UNAME=$(uname -s | tr 'A-Z' 'a-z') LANG_CODE="ENG" TIMESTAMP=`date +%Y-%m-%d`