Adding text string to Description tag

Started by AntiWendel, May 12, 2017, 03:37:32 AM

Previous topic - Next topic

AntiWendel

Hello
I want to add text to the end of the existing text of the -Description tag.
I found one solution:
exiftool -use MWG  '-Description<$Description text string' filepath

If I want to do this with (bash) variables (which may contain whitespace characters) i found this solution:
iitagstring="text string"
DescrAddCommandForExifTool="-Description<\$Description $iitagstring"
exiftool −P -m -overwrite_original -use MWG  "${DescrAddCommandForExifTool}" "$filepath"
Are there any other ways to use variables ?
Thanks a lot :)
Anti

Phil Harvey

Hi Anti,

I don't see why this shouldn't work:

iitagstring="text string"
exiftool -P -m -overwrite_original -use MWG "-Description<\$Description $iitagstring" "$filepath"


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

AntiWendel

Yes Phil you are right.
It works exactly the way you wrote it (in Bash) !
I first tried single quotes instead of double quotes, but that didn't work..
Turns out that double quotes works fine in Bash !
Bash voodoo :)
Thanks !
Anti

Phil Harvey

Hi Anti,

Yes.  Shell variables are interpolated within double-quoted strings but not single-quoted strings in bash.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).