Mac Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsMac Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old September 18th, 2006, 03:58 PM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
Double Click Bash From Desktop

I am relatively new to Mac OS. I am trying to do something which I perceive should be simple. I have created a 'bash' script and put it on the Desktop. All I want to do is double click it and have it run. But its tell me either:

1. There is no program associated with this file, or
2. Its opening a text editor

This program is just going to be downloaded from a website onto a users machine and should be ran. I don't want the end user to have to do any configuration. Is this possible somehow?

Reply With Quote
  #2  
Old September 18th, 2006, 05:00 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
end it's filename in `.command`

Reply With Quote
  #3  
Old September 18th, 2006, 05:08 PM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
Someone else told me to do that. So now I can click it. But it doesn't execute. When I run it from the command line, it runs. All I'm doing in the file is this:

echo "TEST" > /Users/me/Desktop/test.txt

When I double click the icon blinks and flashes for a second, like it ran, but nothing happens. From command line it works perfectly. I must be overlooking something. Permissions are 777 for testing purposes.

Reply With Quote
  #4  
Old September 18th, 2006, 05:17 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
You need to put a shebang line on the top of it

Code:
#!/usr/bin/bash


That means `when this is run just by scriptname, make bash run it`

Reply With Quote
  #5  
Old September 18th, 2006, 05:20 PM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
Thanks, but yes, I have that as well. This is my file:

****************
#!/bin/bash
echo "TEST" > /Users/me/Desktop/test.txt
****************

Very simple, but very frustrating.

Reply With Quote
  #6  
Old September 18th, 2006, 05:25 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
Alright, what does it say when you do this in bash?
`open /path/to/file.sh.command`

Reply With Quote
  #7  
Old September 18th, 2006, 05:52 PM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
The bash.sh.command file is on my desktop. So from my terminal I just typed:

# open /Users/me/Desktop/bash.sh.command

Didn't do anything. Just came back with a prompt on the next line.

Reply With Quote
  #8  
Old September 18th, 2006, 05:55 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
Theoretically it just ran your script then. *shrug*

Reply With Quote
  #9  
Old September 18th, 2006, 06:17 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 4 h 34 m 24 sec
Reputation Power: 787
Send a message via AIM to edman007
well i'm having the same problem too, and since you want to know i have decided to find out, lets see what does it

the shebang does not work
the .command thing does not work
the execute bit does not work
deleting the .DS_Store and logging out/in does not work

right-click->Get Info->Open With->other application->/Applications/Utilities/Terminal.app
- the above will make it run, but it does this by opening the terminal and running it there

now looking at Terminals help, i see this

Quote:
Originally Posted by Apple
To send a UNIX or shell command from an AppleScript:

Enter: do shell script- command
Where "command" is the command or shell script to execute. (For example: "ls" or "/bin/ps -auxwww".)


so then this apple script will run the shell script on my desktop without opening the terminal, you will just see the apple-script icon jump on the dock for a minute (or longer if it takes a while)

Code:
do shell script- "/Users/edman007/Desktop/Synergy.sh"


i think apple script will let you save the script in an application bundle so you can keep the script where ever you move the script and not worry about deleting the shell script
__________________
Feed ME

Reply With Quote
  #10  
Old September 18th, 2006, 06:25 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008

Reply With Quote
  #11  
Old September 18th, 2006, 06:37 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 4 h 34 m 24 sec
Reputation Power: 787
Send a message via AIM to edman007
Quote:
Originally Posted by LinuxPenguin


that does work, but only if its a new file, if it was mapped to an application before you try this it will not work (for example if you save it with a text editor it will usually make it open with that program), OSX will keep the application assigned to open any file in resource forks somewhere (i though .DS_Store file was it, but i guess not), the file is tracked by the filesystem id, so moving it, modifying it, and renaming it will not change what it opens with, the extension has no affect if it has already found an application to open it, same with permissions

the "open with" thing i listed will change what the finder uses (but not its icon), then it will execute with the terminal, and the apple script thing i showed will make it execute as part of your apple script, and it won't use the terminal
Comments on this post
LinuxPenguin agrees: So much for macs being easiest eh? Your applescript was a good solution

Reply With Quote
  #12  
Old September 19th, 2006, 09:55 AM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
Thanks for all the responses. So after I 'gave up' and decided to work on something else for a while, it started to work. Basically I just closed the terminal window that this appeared to be associated with. I opened up another one and then it would work with running from the command-line and also with double clicking.

Argh....5 hours for this?

Thanks all for your help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsMac Help > Double Click Bash From Desktop


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Po