Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > the .command script file trick

the .command script file trick
Thread Tools
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 3, 2005, 12:28 PM
 
I know that here on OS X 10.3 I can write a script
(say, bash or python), name it with a .command file
name suffix, double-click it from the Finder, and
it will execute in its own Terminal window.

Will this .command filename extension trick also work
with 10.1?

If not, is there an easy way to make a bash or python
script "double-clickable" in 10.1?
     
johnMG  (op)
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 3, 2005, 01:55 PM
 
Darn. Turns out that, within the script, I need to
execute a chown command. Double-clicking it from
10.3 (I won't be at the 10.1 machine until tomorrow)
tells me that I don't have access to be running chown.

I could run the script from
the Terminal as "sudo ./my_script.command" and it
will work that way, but what I really need is to be
able to double-click it.

Maybe I need to learn what "Folder Actions" means,
though I don't even know if 10.1 supports those.
     
johnMG  (op)
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 4, 2005, 11:15 AM
 
epilogue:

Yes, the .command suffix trick works with 10.1.

I didn't see bash on 10.1, just sh.

No, didn't need to mess with "Folder Actions" -- though
I think they are AppleScript-only.

Regarding sudo, I wrote one script that does all the
work calling chown, and then a 2nd script that calls
the first as: 'sudo /path/to/first/script.sh'. The
2nd script ends in .command, can be double-clicked
(via an alias on the user's desktop), and prompts
for a password. Nice.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:08 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2