Solved array bug

This commit is contained in:
Kevin Veen-Birkenbach 2020-12-11 00:20:25 +01:00
parent 2b8969616f
commit b0115dd19b

View File

@ -3,7 +3,6 @@
# @param $1 Working directory # @param $1 Working directory
# @param $2 language # @param $2 language
# @param $3 mode (update,initialize) # @param $3 mode (update,initialize)
# shellcheck disable=SC2144 # Deactivate wrong error message
if [ -z "$2" ] if [ -z "$2" ]
then then
echo "You need to define an working directory and a language" && exit 1; echo "You need to define an working directory and a language" && exit 1;
@ -33,7 +32,7 @@ else
fi fi
fi fi
for origin_file in "$ORIGIN_FOLDER"*.*; do for origin_file in "$ORIGIN_FOLDER"*.*; do
if [ "$MODE" = "update" ] && [ ! -f "$OUTPUT_FOLDER$(basename "$origin_file")"* ] || [ "$MODE" = "initialize" ]; then if [ "$MODE" = "update" ] && [ "$(find "$OUTPUT_FOLDER" -name "$(basename "$origin_file")"* -printf '.' | wc -m)" -lt "1" ] || [ "$MODE" = "initialize" ]; then
if [ "$(head -c 4 "$origin_file")" = "%PDF" ]; then if [ "$(head -c 4 "$origin_file")" = "%PDF" ]; then
tmp_file="$TMP_FOLDER$(basename "$origin_file")" tmp_file="$TMP_FOLDER$(basename "$origin_file")"
txt_output_file="$OUTPUT_FOLDER$(basename "$origin_file").txt" txt_output_file="$OUTPUT_FOLDER$(basename "$origin_file").txt"