With the -p option I print command lines which I can apply to other files. For example:
exiftool -q -q -m -n -if 'not $GPSLatitude =~/-/i and not $GPSLongitude =~/-/i' -p 'exiftool -GPSLatitude="$GPSLatitude" -GPSLatitudeRef="North" -GPSLongitude="$GPSLongitude" -GPSLongitudeRef="East" -overwrite_original -P ' -execute -q -q -m -n -if '$GPSLatitude =~/-/i and not $GPSLongitude =~/-/i' -p 'exiftool -GPSLatitude="$GPSLatitude" -GPSLatitudeRef="South" -GPSLongitude="$GPSLongitude" -GPSLongitudeRef="East" -overwrite_original -P ' -execute -q -q -m -n -if 'not $GPSLatitude =~/-/i and $GPSLongitude =~/-/i' -p 'exiftool -GPSLatitude="$GPSLatitude" -GPSLatitudeRef="North" -GPSLongitude="$GPSLongitude" -GPSLongitudeRef="West" -overwrite_original -P ' -execute -q -q -m -n -if '$GPSLatitude =~/-/i and $GPSLongitude =~/-/i' -p 'exiftool -GPSLatitude="$GPSLatitude" -GPSLatitudeRef="South" -GPSLongitude="$GPSLongitude" -GPSLongitudeRef="West" -overwrite_original -P ' -common_args
What I also want to do is to print a command which contain dollar signs and/or single quotes. Is that possible?
- Fulco
Hi Fulco,
In the exiftool -p argument, "$$" may be used to print "$".
How to generate a single quote inside single quotes depends on what shell you are using.
- Phil
Hello Phil,
I use the Terminal app on my Mac if that is what you mean. I've already tried a back slash but it didn't work.
- Fulco
Quote from: Fulco on April 07, 2016, 10:17:04 AM
I use the Terminal app on my Mac if that is what you mean.
No, I mean the shell running the terminal. I use tcsh, but I think bash is default for recent versions of OS X.
I don't know if this is the best way, but this works in bash to get a single quote:
> exiftool -echo 'here'"'"'s a test'
here's a test
This also works:
> exiftool -echo 'here'\''s a test'
here's a test
- Phil
Thank you! It works. It is indeed bash.
- Fulco