From 0168eedde8b2f88eeee014043e655d4c0c4c2249 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Fri, 19 Aug 2022 18:07:23 +0200 Subject: [PATCH] Quit if no keywords found. --- keywords2insta.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/keywords2insta.sh b/keywords2insta.sh index 081454b..b4d8924 100755 --- a/keywords2insta.sh +++ b/keywords2insta.sh @@ -53,13 +53,17 @@ exif=$(exiftool -Canon -s -Keywords "$file") # error occurred, or 2 if all files failed the -if condition (for any of # the commands if -execute was used). -#echo "$exif" -# Keywords : Anemone pulsatilla, Anemone pulsatille, _bleu_ # keywords k=$(echo "$exif" | sed -n '/^Keywords/p' | awk -F":" '{print $2}' | sed 's/^ *//g') # _vert_, accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut -echo "$k" + +if [ -z "$k" ]; then + echo -e "${bold}${red}No Keywords found !${reset}" + echo "Quit." + exit 1 +fi + # Anemone pulsatilla, Anemone pulsatille, _bleu_ IFS="," read -a key <<< "$k" @@ -75,8 +79,6 @@ do fi k_fr=$(echo "$ii") - echo "k_fr: $k_fr long: "${#k_fr} - echo "k_en: $k_en long: "${#k_en} if [ -n "$k_en" ]; then echo "fr & en"