ExifTool Forum

ExifTool => Newbies => Topic started by: AntiWendel on May 12, 2017, 03:37:32 AM

Title: Adding text string to Description tag
Post by: AntiWendel on May 12, 2017, 03:37:32 AM
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
Title: Re: Adding text string to Description tag
Post by: Phil Harvey on May 12, 2017, 07:21:08 AM
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
Title: Re: Adding text string to Description tag
Post by: AntiWendel on May 12, 2017, 08:43:48 AM
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
Title: Re: Adding text string to Description tag
Post by: Phil Harvey on May 12, 2017, 08:47:42 AM
Hi Anti,

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

- Phil