Skip to content

Commit

Permalink
Exit training script if run command failed; fixes #2005
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Oct 20, 2018
1 parent 5a4288f commit 4869406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/training/tesstrain.sh
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/training/tesstrain_utils.sh
Expand Up @@ -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`
Expand Down

0 comments on commit 4869406

Please sign in to comment.