ExifTool Forum

ExifTool => Newbies => Topic started by: jhbennett on August 25, 2022, 11:19:06 AM

Title: bash and zsh
Post by: jhbennett on August 25, 2022, 11:19:06 AM
Hello
Simply trying 
exiftool -s1 -sort -G -*date* <FILENAME>

it works with bash

it doesn't work with zsh

Any solutions? as MACOS (Monterey) suggests I use zsh instead of bash...

Thanks
Title: Re: bash and zsh
Post by: StarGeek on August 25, 2022, 12:09:38 PM
Put the asterisks in quotes.  In some linux shells (I thought all, but apparently not), the an asterisk without quotes is file globbing and those asterisks are being replaced by file names.

I would also suggest using -Time:All, as not all time related tags have date in the name

exiftool -s1 -sort -G -Time:All /path/to/files/

Edit: Found an ELI5 post on file globbing (https://www.reddit.com/r/explainlikeimfive/comments/21bmls/eli5_bash_globbing_and_grep_i_am_having_trouble/)
Title: Re: bash and zsh
Post by: Alan Clifford on August 25, 2022, 12:41:32 PM
I haven't moved to zsh.

And my shell scripts have #!/bin/bash at the top.
Title: Re: bash and zsh
Post by: jhbennett on August 26, 2022, 07:34:23 AM
Thanks for your help. Not used to a command-line system within a command-line system! A spattering of quotes is obviously the answer to trick either the shell (or the program exiftool) into understanding each other. Globbing is my new saviour...
BTW - I like -Time:All. Are there any other really useful "pseudo" Tags that I should be aware of that are very handy when searching or filtering photo metadata?
Title: Re: bash and zsh
Post by: StarGeek on August 26, 2022, 10:41:42 AM
Time is a Group 2 name.  Group 2 names consist of
Audio
Author
Camera
Device
Document
ExifTool
Image
Location
Other
Preview
Printing
Time
Unknown
Video

The full list can be found under the GetAllGroups function (https://exiftool.org/ExifTool.html#GetAllGroups) or by using the -listg option (https://exiftool.org/exiftool_pod.html#list--listw--listf--listr--listwf--listg-NUM--listd--listx).  In this case it would be -listg2.
Title: Re: bash and zsh
Post by: jhbennett on August 26, 2022, 11:33:26 AM
Thanks for the help and references. I think I'm on the right path now with all the information provided by you and this forum.
I am now ignoring switching between bash and zsh... I'll stick with zsh and try to work around its slight differences, even though most scripts in tutorials and examples seem to be bash oriented. After all, it's only "exec bash" in the Mac terminal to get the bash shell running again!