Under ~/Pictures there are some sub-directories containing jpegs like
~/Pictures/Pics 1/img.jpg.
From bash:
~/Pictures $ `file Pics\ 1/img.jpg`
Output:
Pics 1/img.jpg: JPEG image data, Exif standard:: [TIFF image data,
little-endian, direntries=12, description=....
I create script.sh and chmod a+x
#!/bin/bash
VAR=$(builtin printf "%q" "$1")
CMD="file $VAR"
EXIF=eval "$CMD"
echo "$EXIF"
~/Pictures $ ./script.sh Pics\ 1/img.jpg
Output:
./script.sh: line 4: file Pics\ 1/img.jpg: No such file or directory
Also tried full path for img.jpg and /usr/bin/file
OS: Raspbian updated/upgraded
I've read several similar questions/answers and didn't get the key
EDIT: Maybe it would be useful for someone to use exiftool instead of file
Because of locale issue I posted as a comment in the answer marked as solution (and because I get more info) I am going to use exiftool.
script.sh:
#!/bin/bash
COMM="/usr/bin/exiftool -Description \"$1\""
DESCR=$(eval "$COMM")
DESCRIPTION=${DESCR#"Description : "}
echo "$DESCRIPTION"
It outputs correctly the metatada Description with special characters