Skip to content

Commit 95d9c8c

Browse files
committed
set default values for unset variables
setting default values for posibly unset variables avoids unbount variabe errors
1 parent 7b32e64 commit 95d9c8c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/training/language-specific.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,8 @@ VERTICAL_FONTS=( \
868868
"Baekmuk Batang Patched" \ # for kor
869869
)
870870

871+
FLAGS_webtext_prefix=${FLAGS_webtext_prefix:-}
872+
871873
# Set language-specific values for several global variables, including
872874
# ${TEXT_CORPUS}
873875
# holds the text corpus file for the language, used in phase F
@@ -1164,16 +1166,16 @@ set_lang_specific_parameters() {
11641166

11651167
*) err_exit "Error: ${lang} is not a valid language code"
11661168
esac
1167-
if [[ ${FLAGS_mean_count} -gt 0 ]]; then
1169+
if [[ ${FLAGS_mean_count:-} -gt 0 ]]; then
11681170
TRAINING_DATA_ARGUMENTS+=" --mean_count=${FLAGS_mean_count}"
1169-
elif [[ ! -z ${MEAN_COUNT} ]]; then
1171+
elif [[ ! -z ${MEAN_COUNT:-} ]]; then
11701172
TRAINING_DATA_ARGUMENTS+=" --mean_count=${MEAN_COUNT}"
11711173
fi
11721174
# Default to Latin fonts if none have been set
11731175
test -z "$FONTS" && FONTS=( "${LATIN_FONTS[@]}" )
11741176

11751177
# Default to 0 exposure if it hasn't been set
1176-
test -z "$EXPOSURES" && EXPOSURES=0
1178+
test -z "${EXPOSURES:-}" && EXPOSURES=0
11771179
# Set right-to-left and normalization mode.
11781180
case "${LANG_CODE}" in
11791181
ara | div| fas | pus | snd | syr | uig | urd | kur_ara | heb | yid )

src/training/tesstrain_utils.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ generate_font_image() {
259259
done
260260

261261
run_command text2image ${common_args} --font="${font}" \
262-
--text=${TRAINING_TEXT} ${TEXT2IMAGE_EXTRA_ARGS}
262+
--text=${TRAINING_TEXT} ${TEXT2IMAGE_EXTRA_ARGS:-}
263263
check_file_readable ${outbase}.box ${outbase}.tif
264264

265265
if ((EXTRACT_FONT_PROPERTIES)) &&

0 commit comments

Comments
 (0)