I am having issues when trying to return the one image file that fits the parameters. $1 is the search parameter, in this incident it is "real" which is a tag on one of the images (not two) in the given folder. What happens when I call it "./test.sh real" is it prints off both images, rather than just the one. I imagine it has to deal with me setting up the function return as a variable and/or my condition statement, but I am not quite sure.
#!/bin/bash
for f in specim/*.jpg
do
    image=$(exiftool -EXIF:XPKeywords $f | grep "$1")
    if [[ !  -z  "$image// }"  ]]; then
    echo $f
fi
what's returned:
../../test.sh real
specim/image2.jpg
specim/image.jpg
This bash script prints off what I want, only the one image rather than both (as the exiftool stuff which I don't want, but this was just a test):
#!/bin/bash
for f in *.jpg
do
    exiftool -EXIF:XPKeywords $f | grep $1
done
result:
./test2.sh real
XP Keywords                     : name;real
any help would be appreciated and it's probably super simple... Thanks
"$image// }"looks like a typo for"${image// }"