Exit training script if run command failed; fixes #2005

This commit is contained in:
Zdenko Podobný 2018-10-20 13:00:39 +02:00
parent 5a4288f2fc
commit 486940687c
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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`