Issues with script on Mac

Started by ericconn, January 03, 2024, 11:45:18 AM

Previous topic - Next topic

ericconn

Not sure where to post this or go for help with these issues.

I am well versed with DOS scripting and am getting into scripting for Macs. I am trying to create a final metadata check for JPG files, and my test files worked. I'm looking for issues with various fields, i.e. blank or incorrect values. All of my syntax for the -if statements and such is good. I'm now trying to push it to a production script for my coworkers to use, but I'm getting weird errors. All my files and the script are on a server.

As an example, there are two folders: EVENTS and PORTRAITS. Both are scanned for the a few of the same tagging issues, then for some other issues that pertain to each type of photo.

One issue is that Terminal throws an error that it can't find the PORTRAITS folder, even though I'm copying and pasting from the address bar in Bridge and/or hand typing the path. However, if I copy the same command for the EVENTS path and just replace EVENT with PORTRAITS, it works.

That was the only issue, and then I got another as if I have a bad character/syntax: syntax error near unexpected token `('. I'm looking and can't see anything with the naked eye.

Again, I'm copying and pasting the code right from another line, and only this line is giving me an issue.

Both of these issues seem to be like there's a bad character here and there throwing things off. Is there a debugger or syntax validation tool that could help me with these errors? I'm just using TextEdit.

Phil Harvey

Copying pasting on Mac is problematic. If you do this from posts here in the forum you can get non-breaking spaces instead of ASCII spaces in the pasted text.  I use BBEdit on Mac because it can display invisible characters like this.  Also, you could use hexdump -C FILE to dump the file in hex/ASCII to find any non-ASCII characters.

- 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 ($).

ericconn

Thanks so much, Phil. This is the app I was looking for. One error was very obvious, the inverted question mark for a bad character. The other is still a mystery for me, but I moved one command set from the end to the middle and now I don't get any errors.

Thanks again.