If condition not working on Linux but on Windows it is fine

Started by steinrr, September 28, 2022, 03:24:47 PM

Previous topic - Next topic

steinrr

I was running ExifTool with some if condition to test for a tag on Windows. Everything worked fine.

Tried then to run on both my QNAP NAS and a Raspberry Pi and the if test is not working - even if the tag is present:

pi@raspberrypi:./exiftool -if "$ContentIdentifier" *.MOV
    1 files failed condition
pi@raspberrypi:./exiftool -s -ContentIdentifier *.MOV
ContentIdentifier               : C65670FC-ACC2-47E1-AF37-7533F8097ABE

Running on Windows - it is fine:

exiftool(-k).exe if "$ContentIdentifier" -p "$directory/$filename" *.MOV
./IMG_6852_HEVC.MOV

What is going on here - why is the if test not working on Linux OSes?

StarGeek

From the bottom of every one of Phil's posts

QuoteOn Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

The dollar sign is the start of a shell variable when there are double quotes around it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

steinrr

Quote from: StarGeek on September 28, 2022, 05:05:08 PMThe dollar sign is the start of a shell variable when there are double quotes around it.

Thank you! Changed to single quotes and it worked perfectly!