Benches Uncategorized

3

Trying to make double clickable Terminal Shell ...

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Short version: How do I make a text file of terminal commands executable?

Backgound: I am running OS 10.4.11 and the shell that runs under terminal is Bash. I know almost nothing about Unix and scripts and such, so don't assume anything when giving instructions.

Long Version: I have a terminal program I found called jhead where my only need for it is its ability to change the exif's "orientation" tag in photos. I already figured out how to get jhead into my /usr/bin directory so it is executable from any directory in Terminal.

So here is the command I run in terminal simply to check the orientation tag of all the photos in my photo work directory:

jhead -v ~/Desktop/temp Photos/*.jpg | grep -i orien

All it does is reads the exif info for the photos but filtered to only show the orientation tag. These photos are in the folder "temp Photos" on my desktop. So it works fine.

I read that to make a simple terminal shell script you can make a simple text document, add the extension .command and now you can double click it and it will run any commands in Terminal. I used text edit to create a plain text blank file in that folder. I then used pico in terminal to put the command into the file and saved it.

The file has the right icon, but when I double click it I get this error:

The .command file ‘/Users/Dad/Desktop/temp Photos/orientation_normal.command’ could not open. Most likely it is not executable.

and then when I ok out of that error box, Terminal opens and that is about it.

Assistance?

Thanks,
Patrick

p.s. I want to add a couple more lines to the script so the script will first check the status of all files, change them all, then recheck them. I can then eye ball the terminal window and make sure everything looks correct. But for now I am starting with just the single command to first prove I can make a double-clickable script.

3 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    chmod +x

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    D'oh. So easy. I had used that command on the program files itself, jhead, but it never even occurred to me to use it on the .command text file.

    I got the script working and fleshed it out with the other commands and now it does all the fixing of all the photos in the folder with one double-click. Super!

    Thanks!
    Patrick

  3. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    You may want to look at the free utility Platypus which can turn any script into a double clickable applications including drag-N-drop support.
    <http://www.versiontracker.com/dyn/moreinfo/macosx/19870&gt;